diff --git a/module/report/lang/en.php b/module/report/lang/en.php index e7a07903f6..39a63ecb2a 100644 --- a/module/report/lang/en.php +++ b/module/report/lang/en.php @@ -68,7 +68,8 @@ $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->validRate = "Valid Rate"; +$lang->report->validRateTips = "Resolution is fixed or postponed/status is resolved"; $lang->report->unplanned = 'unplanned'; /* daily reminder. */ diff --git a/module/report/lang/zh-cn.php b/module/report/lang/zh-cn.php index 2b15a16c51..10e573dc9f 100644 --- a/module/report/lang/zh-cn.php +++ b/module/report/lang/zh-cn.php @@ -68,7 +68,8 @@ $lang->report->to = '至'; $lang->report->taskTotal = "总任务数"; $lang->report->manhourTotal = "总工时"; $lang->report->bugTotal = "共%s个Bug"; -$lang->report->effectiveRate = "有效率"; +$lang->report->validRate = "有效率"; +$lang->report->validRateTips = "方案为已解决或延期/状态为已解决"; $lang->report->unplanned = '未计划'; /* daily reminder. */ diff --git a/module/report/model.php b/module/report/model.php index d500129af5..944b94cd72 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -391,27 +391,31 @@ EOT; public function getBugs($begin, $end) { $end = date('Ymd', strtotime("$end +1 day")); - $bugs = $this->dao->select('id, resolution, openedBy')->from(TABLE_BUG) + $bugs = $this->dao->select('id, resolution, openedBy, status')->from(TABLE_BUG) ->where('deleted')->eq(0) ->andWhere('openedDate')->ge($begin) ->andWhere('openedDate')->le($end) ->fetchAll(); + $bugSummary = array(); foreach($bugs as $bug) { $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; + $bugSummary[$bug->openedBy]['all'] = empty($bugSummary[$bug->openedBy]['all']) ? 1 : $bugSummary[$bug->openedBy]['all'] + 1; + if($bug->status == 'resolved') + { + $bugSummary[$bug->openedBy]['resolved'] = empty($bugSummary[$bug->openedBy]['resolved']) ? 1 : $bugSummary[$bug->openedBy]['resolved'] + 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"; + $validRate = 0; + if(isset($bug['fixed'])) $validRate += $bug['fixed']; + if(isset($bug['postponed'])) $validRate += $bug['postponed']; + $bugSummary[$account]['validRate'] = (isset($bug['resolved']) and $bug['resolved']) ? ($validRate / $bug['resolved']) : "0"; } - uasort($bugSummary, 'summaryCmp'); + uasort($bugSummary, 'sortSummary'); return $bugSummary; } @@ -573,8 +577,8 @@ EOT; } } -function summaryCmp($pre, $next) +function sortSummary($pre, $next) { - if($pre['effectiveRate'] == $next['effectiveRate']) return 0; - return $pre['effectiveRate'] > $next['effectiveRate'] ? -1 : 1; + if($pre['validRate'] == $next['validRate']) return 0; + return $pre['validRate'] > $next['validRate'] ? -1 : 1; } diff --git a/module/report/view/bugsummary.html.php b/module/report/view/bugsummary.html.php index 6bdbfd15cd..60bc3c218d 100644 --- a/module/report/view/bugsummary.html.php +++ b/module/report/view/bugsummary.html.php @@ -25,7 +25,7 @@ bug->resolutionList['postponed'];?> bug->resolutionList['willnotfix'];?> bug->resolutionList['tostory'];?> - report->effectiveRate;?> + report->validRate;?> @@ -43,7 +43,7 @@ - +