diff --git a/module/metric/calc/execution/scale/count_of_valid_story_in_execution.php.tmp b/module/metric/calc/execution/scale/count_of_valid_story_in_execution.php similarity index 74% rename from module/metric/calc/execution/scale/count_of_valid_story_in_execution.php.tmp rename to module/metric/calc/execution/scale/count_of_valid_story_in_execution.php index e753a677a8..84ec6ff030 100644 --- a/module/metric/calc/execution/scale/count_of_valid_story_in_execution.php.tmp +++ b/module/metric/calc/execution/scale/count_of_valid_story_in_execution.php @@ -1,7 +1,7 @@ project; + if(!isset($this->result[$project])) $this->result[$project] = 0; + if(!in_array($row->closedReason, array('duplicate','willnotdo','bydesign'))) $this->result[$project] += 1; } public function getResult($options = array()) { - $records = $this->getRecords(array('value')); + $records = $this->getRecords(array('project', 'value')); return $this->filterByOptions($records, $options); } -} \ No newline at end of file +} diff --git a/module/metric/test/calc/execution/scale/count_of_valid_story_in_execution.php b/module/metric/test/calc/execution/scale/count_of_valid_story_in_execution.php new file mode 100755 index 0000000000..91e4dd30a4 --- /dev/null +++ b/module/metric/test/calc/execution/scale/count_of_valid_story_in_execution.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +config('product', $useCommon = true, $levels = 4)->gen(10); +zdTable('project')->config('project_type', $useCommon = true, $levels = 4)->gen(100); +zdTable('story')->config('story_status_closedreason', $useCommon = true, $levels = 4)->gen(1000); +zdTable('projectstory')->config('executionstory', $useCommon = true, $levels = 4)->gen(1000); + +$metric = new metricTest(); +$calc = $metric->calcMetric(__FILE__); + +/** + +title=count_of_valid_story_in_execution +cid=1 +pid=1 + +*/ + +r(count($calc->getResult())) && p('') && e('10'); // 测试分组数。 + +r($calc->getResult(array('project' => '4'))) && p('0:value') && e('3'); // 测试项目4。