forked from tinyspeck/doug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats_alltime.php
43 lines (33 loc) · 1.09 KB
/
stats_alltime.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?
#
# $Id$
#
include('include/init.php');
#
# stats!
#
$open_bugs = db_fetch_all("SELECT COUNT(id) AS num, assigned_user AS user FROM bugs WHERE status='open' GROUP BY user ORDER BY num DESC");
$reso_bugs = db_fetch_all("SELECT COUNT(id) AS num, opened_user AS user FROM bugs WHERE status='resolved' GROUP BY user ORDER BY num DESC");
$fixs_bugs = db_fetch_all("SELECT COUNT(id) as num, assigned_user AS user FROM bugs WHERE (status='closed' OR status='resolved') GROUP BY user ORDER BY num DESC");
$file_bugs = db_fetch_all("SELECT COUNT(id) as num, opened_user AS user FROM bugs GROUP BY user ORDER BY num DESC");
totalize($open_bugs);
totalize($reso_bugs);
totalize($fixs_bugs);
totalize($file_bugs);
function totalize(&$bugs){
$t = 0;
foreach ($bugs as $b){ $t += $b[num]; }
$bugs[] = array(
'user' => 'Total',
'num' => $t,
);
}
$smarty->assign('open_bugs', $open_bugs);
$smarty->assign('reso_bugs', $reso_bugs);
$smarty->assign('fixs_bugs', $fixs_bugs);
$smarty->assign('file_bugs', $file_bugs);
#
# output
#
$smarty->display('page_stats_alltime.txt');
?>