[Mageia-sysadm] [285] display count stats for all packages

root at mageia.org root at mageia.org
Thu Jan 13 15:51:49 CET 2011


Revision: 285
Author:   rda
Date:     2011-01-13 15:51:49 +0100 (Thu, 13 Jan 2011)
Log Message:
-----------
display count stats for all packages

Modified Paths:
--------------
    build_system/web/index.php

Modified: build_system/web/index.php
===================================================================
--- build_system/web/index.php	2011-01-13 14:39:58 UTC (rev 284)
+++ build_system/web/index.php	2011-01-13 14:51:49 UTC (rev 285)
@@ -165,6 +165,8 @@
     tr.partial td.status-box { background: blue; }
     tr.built td.status-box { background: #00ccff; }
     tr.youri td.status-box { background: olive; }
+    
+    #stats { float: right; }
     </style>
 </head>
 <body>
@@ -196,9 +198,20 @@
     <td>%s/%s</td>
     <td class="status-box"></td>
 T;
+
+$stats = array(
+    'uploaded' => 0,
+    'failure'  => 0,
+    'todo'     => 0,
+    'building' => 0,
+    'partial'  => 0,
+    'built'    => 0,
+);
+$total = count($pkgs);
 foreach ($pkgs as $key => $p) {
     $p['type'] = pkg_gettype($p);
 
+    $stats[$p['type']] += 1;
     $s .= sprintf($tmpl,
         $p['type'],
         key2date($key),
@@ -222,9 +235,17 @@
 
     $s .= '</td></tr>';
 }
+echo $s, '</table>';
+
+$s = '<div id="stats"><table><tr><th>Status</th><th>Count</th><th>%</th></tr>';
+foreach ($stats as $k => $v) {
+    $s .= sprintf('<tr><th>%s</th><td>%d</td><td>%d%%</td></tr>',
+        $k, $v, round($v/$total*100));
+}
+$s .= '</table></div>';
+
 echo $s;
+
 ?>
-</table>
-
 </body>
 </html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20110113/5701993f/attachment.html>


More information about the Mageia-sysadm mailing list