From 04e62206ecc31219ae32c64021f45f4f00455c90 Mon Sep 17 00:00:00 2001 From: daitingting Date: Thu, 8 Aug 2024 09:28:33 +0000 Subject: [PATCH] [task#124861,doing,1h] Add count_of_verified_story_in_execution_when_closing metric. --- ...rified_story_in_execution_when_closing.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_verified_story_in_execution_when_closing.php diff --git a/module/metric/calc/execution/scale/count_of_verified_story_in_execution_when_closing.php b/module/metric/calc/execution/scale/count_of_verified_story_in_execution_when_closing.php new file mode 100644 index 0000000000..1b00235498 --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_verified_story_in_execution_when_closing.php @@ -0,0 +1,47 @@ + + * @package + * @uses func + * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html) + * @Link https://www.zentao.net + */ +class count_of_verified_story_in_execution_when_closing extends baseCalc +{ + public $dataset = 'getAllStoriesWithExecution'; + + public $fieldList = array('t3.project', 't1.stage', 't1.closedReason', 't1.releasedDate', 't1.closedDate AS storyClosedDate', 't4.closedDate'); + + public $result = array(); + + public function calculate($row) + { + $execution = $row->project; + + if(!isset($this->result[$execution])) $this->result[$execution] = 0; + if($row->stage == 'verified' && $row->verifiedDate <= $row->closedDate + || $row->stage == 'released' && $row->releasedDate <= $row->closedDate + || $row->closedReason == 'done' && $row->storyClosedDate <= $row->closedDate) + { + $this->result[$execution] += 1; + } + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('execution', 'value')); + return $this->filterByOptions($records, $options); + } +}