From 50d4bbba42591d673bda6476ec6e9a4e1b366a24 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Wed, 7 Aug 2024 09:27:49 +0800 Subject: [PATCH] * [task#124846,doing,0.3h] add metric calc. --- .../scale/scale_of_dev_story_in_execution.php | 20 +++++++++++++++++++ module/metric/dataset.php | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/module/metric/calc/execution/scale/scale_of_dev_story_in_execution.php b/module/metric/calc/execution/scale/scale_of_dev_story_in_execution.php index aacb2d0304..d17649f9fa 100644 --- a/module/metric/calc/execution/scale/scale_of_dev_story_in_execution.php +++ b/module/metric/calc/execution/scale/scale_of_dev_story_in_execution.php @@ -18,3 +18,23 @@ * @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 scale_of_dev_story_in_execution extends baseCalc +{ + public $dataset = 'getDevStoriesWithExecution'; + + public $fieldList = array('t3.project', 't1.estimate'); + + public $result = array(); + + public function calculate($row) + { + if(!isset($this->result[$row->project])) $this->result[$row->project] = 0; + $this->result[$row->project] += $row->estimate; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('execution', 'value')); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/dataset.php b/module/metric/dataset.php index 1c47c425fa..b2b74605ff 100644 --- a/module/metric/dataset.php +++ b/module/metric/dataset.php @@ -356,10 +356,10 @@ class dataset ->andWhere('t2.deleted')->eq(0) ->andWhere('t1.type')->eq('story') ->andWhere('t2.shadow')->eq(0) - ->andWhere('t4.deleted')->eq(0) // 已删除的执行 + ->andWhere('t4.deleted')->eq(0) ->andWhere('t4.type')->in('sprint,stage,kanban') ->andWhere('t4.multiple')->eq('1') - ->andWhere('t5.deleted')->eq(0); // 已删除的项目 + ->andWhere('t5.deleted')->eq(0); return $this->defaultWhere($stmt, 't1'); }