diff options
author | Romain d'Alverny <rda@mageia.org> | 2011-01-13 14:51:49 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2011-01-13 14:51:49 +0000 |
commit | 53c065ff50bb8dac90e9ee70cd0b4d31ed1ffbd1 (patch) | |
tree | 1907878e7c256f3f2f8d166a7ef3aa4b453bbccf /index.php | |
parent | ad5d7d954ed894a6648700d21ff96664afa6c754 (diff) | |
download | pkgsubmit-53c065ff50bb8dac90e9ee70cd0b4d31ed1ffbd1.tar pkgsubmit-53c065ff50bb8dac90e9ee70cd0b4d31ed1ffbd1.tar.gz pkgsubmit-53c065ff50bb8dac90e9ee70cd0b4d31ed1ffbd1.tar.bz2 pkgsubmit-53c065ff50bb8dac90e9ee70cd0b4d31ed1ffbd1.tar.xz pkgsubmit-53c065ff50bb8dac90e9ee70cd0b4d31ed1ffbd1.zip |
display count stats for all packages
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -165,6 +165,8 @@ function key2date($key) { 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 @@ $tmpl = <<<T <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 @@ foreach ($pkgs as $key => $p) { $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> |