xaizek / fragile (License: AGPLv3+) (since 2018-12-07)
Simple lightweight CI, attempting to be somewhat Unix-like in its philosophy.
Commit 58270e5f6fb55abf8f44976239f63bc680fc52ba

Move build sorting function to Builds class
Author: xaizek
Author date (UTC): 2017-07-03 10:23
Committer name: xaizek
Committer date (UTC): 2017-07-03 10:51
Parent(s): c04e80d13b317b0612e954e453a316a07c077b28
Signing key: 99DC5E4DB05F6BE2
Tree: 87a5c7747e2e72689e434cae335bbe31456fb2e8
File Lines added Lines deleted
classes/Builds.php 21 0
dashboard.php 1 21
File classes/Builds.php changed (mode: 100644) (index cc492af..765093b)
... ... class Builds
118 118 { {
119 119 return $x->buildsetid; return $x->buildsetid;
120 120 } }
121
122 /**
123 * @brief Custom key comparison function for a dictionary.
124 *
125 * Treats keys with slashes in them as greater than other keys.
126 *
127 * @param a First key.
128 * @param b Second key.
129 *
130 * @returns Value less than, equal to or greater than zero to indicate
131 * order.
132 */
133 public static function builderCmp($a, $b)
134 {
135 $condA = (strpos($a, '/') !== false);
136 $condB = (strpos($b, '/') !== false);
137 if ($condA ^ $condB) {
138 return $condA ? 1 : -1;
139 }
140 return strcmp($a, $b);
141 }
121 142 } }
122 143
123 144 ?> ?>
File dashboard.php changed (mode: 100644) (index 5842312..75029cd)
... ... function displayDashboard()
56 56 function printBuildTable($buildsets, $builders) function printBuildTable($buildsets, $builders)
57 57 { {
58 58 // sort builders by their name // sort builders by their name
59 uksort($builders, "builderCmp");
59 uksort($builders, "Builds::builderCmp");
60 60
61 61 // output table header // output table header
62 62 print '<table class="dashboard"><tr><td></td>' . "\n"; print '<table class="dashboard"><tr><td></td>' . "\n";
 
... ... function printBuildTable($buildsets, $builders)
101 101 print "</table>\n"; print "</table>\n";
102 102 } }
103 103
104 /**
105 * @brief Custom key comparison function.
106 *
107 * Treats keys with slashes in them as greater than other keys.
108 *
109 * @param a First key.
110 * @param b Second key.
111 *
112 * @returns Value less than, equal to or greater than zero to indicate order.
113 */
114 function builderCmp($a, $b)
115 {
116 $condA = (strpos($a, '/') !== false);
117 $condB = (strpos($b, '/') !== false);
118 if ($condA ^ $condB) {
119 return $condA ? 1 : -1;
120 }
121 return strcmp($a, $b);
122 }
123
124 104 /** /**
125 105 * @brief Checks whether particular status has associated output. * @brief Checks whether particular status has associated output.
126 106 * *
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/fragile

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/fragile

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master