diff --git a/module/metric/calc/global/scale/count_of_delayed_finished_execution_which_finished.php b/module/metric/calc/global/scale/count_of_delayed_finished_execution_which_finished.php index b660b7dc76..6eabd8fffe 100644 --- a/module/metric/calc/global/scale/count_of_delayed_finished_execution_which_finished.php +++ b/module/metric/calc/global/scale/count_of_delayed_finished_execution_which_finished.php @@ -30,9 +30,9 @@ class count_of_delayed_finished_execution_which_finished extends baseCalc public function calculate($row) { - if(empty($row->closedDate) or empty($row->firstEnd)) return false; + if(empty($row->closedDate) || empty($row->firstEnd)) return false; - if($row->status == 'closed' and $row->closedDate <= $row->firstEnd) $this->result ++; + if($row->status == 'closed' and $row->closedDate > $row->firstEnd) $this->result ++; } public function getResult($options = array()) diff --git a/module/metric/test/calc/global/scale/count_of_delayed_finished_execution_which_annual_finished.php b/module/metric/test/calc/global/scale/count_of_delayed_finished_execution_which_annual_finished.php index 6fb976be18..f914c21215 100755 --- a/module/metric/test/calc/global/scale/count_of_delayed_finished_execution_which_annual_finished.php +++ b/module/metric/test/calc/global/scale/count_of_delayed_finished_execution_which_annual_finished.php @@ -3,8 +3,8 @@ include dirname(__FILE__, 7) . '/test/lib/init.php'; include dirname(__FILE__, 4) . '/calc.class.php'; -zdTable('project')->config('project_close', $useCommon = true, $levels = 4)->gen(10); -zdTable('project')->config('execution', $useCommon = true, $levels = 4)->gen(100, false); +zdTable('project')->config('project_close', $useCommon = true, $levels = 4)->gen(10); +zdTable('project')->config('execution_delayed', $useCommon = true, $levels = 4)->gen(100, false); $metric = new metricTest(); $calc = $metric->calcMetric(__FILE__); diff --git a/module/metric/test/calc/global/scale/count_of_delayed_finished_execution_which_finished.php b/module/metric/test/calc/global/scale/count_of_delayed_finished_execution_which_finished.php new file mode 100755 index 0000000000..b411651ead --- /dev/null +++ b/module/metric/test/calc/global/scale/count_of_delayed_finished_execution_which_finished.php @@ -0,0 +1,20 @@ +#!/usr/bin/env php +config('project_close', $useCommon = true, $levels = 4)->gen(10); +zdTable('project')->config('execution_delayed', $useCommon = true, $levels = 4)->gen(100, false); + +$metric = new metricTest(); +$calc = $metric->calcMetric(__FILE__); + +/** + +title=count_of_delayed_finished_execution_which_finished +timeout=0 +cid=1 + +*/ + +r($calc->getResult()) && p('') && e('16'); // 测试分组数 diff --git a/module/metric/test/yaml/execution.yaml b/module/metric/test/yaml/execution.yaml index 22944eccd6..8b85d953b0 100644 --- a/module/metric/test/yaml/execution.yaml +++ b/module/metric/test/yaml/execution.yaml @@ -21,8 +21,4 @@ fields: range: "20110101 000000-20210101 000000:10D" type: timestamp format: YYYY-MM-DD -- field: firstEnd - range: "20010101 000000-20110101 000000:10D" - type: timestamp - format: YYYY-MM-DD ... diff --git a/module/metric/test/yaml/execution_delayed.yaml b/module/metric/test/yaml/execution_delayed.yaml new file mode 100644 index 0000000000..22944eccd6 --- /dev/null +++ b/module/metric/test/yaml/execution_delayed.yaml @@ -0,0 +1,28 @@ +--- +title: zt_project +author: qixinzhi +version: "1.0" +fields: +- field: id + range: 11-10000 +- field: project + range: 1-10{20} +- field: type + range: sprint +- field: status + range: closed{4},doing{3},suspended{2},wait{1} +- field: deleted + range: 0{10},1{10} +- field: openedDate + range: "20100101 000000-20200101 000000:10D" + type: timestamp + format: YYYY-MM-DD +- field: closedDate + range: "20110101 000000-20210101 000000:10D" + type: timestamp + format: YYYY-MM-DD +- field: firstEnd + range: "20010101 000000-20110101 000000:10D" + type: timestamp + format: YYYY-MM-DD +... diff --git a/module/metric/test/yaml/execution_undelayed.yaml b/module/metric/test/yaml/execution_undelayed.yaml new file mode 100644 index 0000000000..86d5dd0556 --- /dev/null +++ b/module/metric/test/yaml/execution_undelayed.yaml @@ -0,0 +1,28 @@ +--- +title: zt_project +author: qixinzhi +version: "1.0" +fields: +- field: id + range: 11-10000 +- field: project + range: 1-10{20} +- field: type + range: sprint +- field: status + range: closed{4},doing{3},suspended{2},wait{1} +- field: deleted + range: 0{10},1{10} +- field: openedDate + range: "20100101 000000-20200101 000000:10D" + type: timestamp + format: YYYY-MM-DD +- field: closedDate + range: "20110101 000000-20210101 000000:10D" + type: timestamp + format: YYYY-MM-DD +- field: firstEnd + range: "20210101 000000-20131101 000000:10D" + type: timestamp + format: YYYY-MM-DD +...