summaryrefslogtreecommitdiff
path: root/buildmaster
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-17 14:22:21 +0200
committerErich Eckner <git@eckner.net>2018-10-17 14:22:21 +0200
commitea6b55847dd628792f1e92f9dbc75a872b0b76a8 (patch)
treee44afec39403c85047d74328c3afe58df6a1597c /buildmaster
parent37c2cc1204483de9930a8455ce46ec077cf97b88 (diff)
downloadarchweb32-ea6b55847dd628792f1e92f9dbc75a872b0b76a8.tar.xz
buildmaster/statistics.php: now knows about `statistics`.`architecture`
Diffstat (limited to 'buildmaster')
-rw-r--r--buildmaster/statistics.php49
1 files changed, 38 insertions, 11 deletions
diff --git a/buildmaster/statistics.php b/buildmaster/statistics.php
index cf3b0d0..5378616 100644
--- a/buildmaster/statistics.php
+++ b/buildmaster/statistics.php
@@ -7,22 +7,49 @@ if (isset($_GET["from"]))
else
$min_time="\"-7 00:00:00\"";
+if (isset($_GET["arch"])) {
+ $arch_filter="`architectures`.`name`=from_base64(\"" . base64_encode($_GET["arch"]) . "\")";
+ $combiner_left="";
+ $combiner_right="";
+ $grouper="";
+ $joiner=" JOIN `architectures` ON `statistics`.`architecture`=`architectures`.`id`";
+} else {
+ $arch_filter="1";
+ $combiner_left="SUM(";
+ $combiner_right=")";
+ $grouper=" GROUP BY `statistics`.`date`";
+ $joiner="";
+};
+
+$column_list = array(
+ "pending_tasks_count",
+ "pending_packages_count",
+ "staging_packages_count",
+ "testing_packages_count",
+ "tested_packages_count",
+ "broken_tasks_count",
+ "dependency_loops_count",
+ "dependency_looped_tasks_count",
+ "locked_tasks_count",
+ "blocked_tasks_count",
+ "next_tasks_count"
+);
+
+function combine_column($name) {
+ global $combiner_left;
+ global $combiner_right;
+ return $combiner_left . "`statistics`.`" . $name . "`" . $combiner_right . " AS `" . $name . "`";
+}
+
$result = mysql_run_query(
"SELECT DISTINCT ".
"UNIX_TIMESTAMP(`statistics`.`date`) AS `date`," .
- "`statistics`.`pending_tasks_count`," .
- "`statistics`.`pending_packages_count`," .
- "`statistics`.`staging_packages_count`," .
- "`statistics`.`testing_packages_count`," .
- "`statistics`.`tested_packages_count`," .
- "`statistics`.`broken_tasks_count`," .
- "`statistics`.`dependency_loops_count`," .
- "`statistics`.`dependency_looped_tasks_count`," .
- "`statistics`.`locked_tasks_count`," .
- "`statistics`.`blocked_tasks_count`," .
- "`statistics`.`next_tasks_count`" .
+ implode(",",array_map("combine_column",$column_list)) .
"FROM `statistics` " .
+ $joiner .
"WHERE `statistics`.`date`>=ADDDATE(NOW()," . $min_time . ") " .
+ "AND " . $arch_filter .
+ $grouper .
"ORDER BY `statistics`.`date`"
);