From 08a6ef16f4485fe95a2f3e019a399c753969f7ad Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Tue, 16 Apr 2013 07:35:07 +0000 Subject: [PATCH] * finish task#1363. --- module/report/lang/en.php | 1 + module/report/lang/zh-cn.php | 1 + module/report/model.php | 16 ++++++++++++++++ module/report/view/bugsummary.html.php | 2 ++ 4 files changed, 20 insertions(+) diff --git a/module/report/lang/en.php b/module/report/lang/en.php index 1340674e37..e7a07903f6 100644 --- a/module/report/lang/en.php +++ b/module/report/lang/en.php @@ -68,6 +68,7 @@ $lang->report->to = 'to'; $lang->report->taskTotal = "Task Total"; $lang->report->manhourTotal = "Manhour Total"; $lang->report->bugTotal = "%s Bugs"; +$lang->report->effectiveRate = "Effective Rate"; $lang->report->unplanned = 'unplanned'; /* daily reminder. */ diff --git a/module/report/lang/zh-cn.php b/module/report/lang/zh-cn.php index bcd185ec25..2b15a16c51 100644 --- a/module/report/lang/zh-cn.php +++ b/module/report/lang/zh-cn.php @@ -68,6 +68,7 @@ $lang->report->to = '至'; $lang->report->taskTotal = "总任务数"; $lang->report->manhourTotal = "总工时"; $lang->report->bugTotal = "共%s个Bug"; +$lang->report->effectiveRate = "有效率"; $lang->report->unplanned = '未计划'; /* daily reminder. */ diff --git a/module/report/model.php b/module/report/model.php index 4e6b0fcc9a..d500129af5 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -402,6 +402,16 @@ EOT; $bugSummary[$bug->openedBy][$bug->resolution] = empty($bugSummary[$bug->openedBy][$bug->resolution]) ? 1 : $bugSummary[$bug->openedBy][$bug->resolution] + 1; $bugSummary[$bug->openedBy]['all'] = empty($bugSummary[$bug->openedBy]['all']) ? 1 : $bugSummary[$bug->openedBy]['all'] + 1; } + + foreach($bugSummary as $account => $bug) + { + $effectiveRate = 0; + if(isset($bug['fixed'])) $effectiveRate += $bug['fixed']; + if(isset($bug['external'])) $effectiveRate += $bug['external']; + if(isset($bug['postponed'])) $effectiveRate += $bug['postponed']; + $bugSummary[$account]['effectiveRate'] = $bug['all'] ? ($effectiveRate / $bug['all']) : "0"; + } + uasort($bugSummary, 'summaryCmp'); return $bugSummary; } @@ -562,3 +572,9 @@ EOT; return $todos; } } + +function summaryCmp($pre, $next) +{ + if($pre['effectiveRate'] == $next['effectiveRate']) return 0; + return $pre['effectiveRate'] > $next['effectiveRate'] ? -1 : 1; +} diff --git a/module/report/view/bugsummary.html.php b/module/report/view/bugsummary.html.php index 430797d834..0b74314522 100644 --- a/module/report/view/bugsummary.html.php +++ b/module/report/view/bugsummary.html.php @@ -25,6 +25,7 @@ bug->resolutionList['postponed'];?> bug->resolutionList['willnotfix'];?> bug->resolutionList['tostory'];?> + report->effectiveRate;?> @@ -42,6 +43,7 @@ +