From 2bcf35cd7d965e0857a15a4dd2aa815a184aa10c Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 10 Jun 2025 13:43:14 +0800 Subject: [PATCH 1/5] + [task#144711,doing,0.4h] add count_of_tested_story metric. --- .../system/scale/count_of_tested_story.php | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 module/metric/calc/system/scale/count_of_tested_story.php diff --git a/module/metric/calc/system/scale/count_of_tested_story.php b/module/metric/calc/system/scale/count_of_tested_story.php new file mode 100644 index 0000000000..3175ef2e0d --- /dev/null +++ b/module/metric/calc/system/scale/count_of_tested_story.php @@ -0,0 +1,39 @@ + + * @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_tested_story extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = 0; + + public function calculate($row) + { + if($row->stage == 'tested') $this->result ++; + } + + public function getResult($options = array()) + { + $records = array(array('value' => $this->result)); + return $this->filterByOptions($records, $options); + } +} From 5a22d629c02babd02d8aa204a7eaf6f98313b579 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 10 Jun 2025 13:43:28 +0800 Subject: [PATCH 2/5] + [task#144711,doing,0.4h] add count_of_tested_story metric. --- .../system/scale/scale_of_tested_story.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 module/metric/calc/system/scale/scale_of_tested_story.php diff --git a/module/metric/calc/system/scale/scale_of_tested_story.php b/module/metric/calc/system/scale/scale_of_tested_story.php new file mode 100644 index 0000000000..079626d10e --- /dev/null +++ b/module/metric/calc/system/scale/scale_of_tested_story.php @@ -0,0 +1,42 @@ + + * @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 scale_of_tested_story extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = 0; + + public function calculate($row) + { + if($row->isParent == '1') return false; + if(empty($row->estimate)) return null; + + if($row->stage == 'tested') $this->result += $row->estimate; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('value')); + return $this->filterByOptions($records, $options); + } +} From f856d8b4d244564783063eefcddd7d649f5e5d85 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 10 Jun 2025 13:44:00 +0800 Subject: [PATCH 3/5] + [task#144593,doing,0.4h] add scale_of_closed_story metric. --- .../system/scale/scale_of_closed_story.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 module/metric/calc/system/scale/scale_of_closed_story.php diff --git a/module/metric/calc/system/scale/scale_of_closed_story.php b/module/metric/calc/system/scale/scale_of_closed_story.php new file mode 100644 index 0000000000..bec8f088aa --- /dev/null +++ b/module/metric/calc/system/scale/scale_of_closed_story.php @@ -0,0 +1,42 @@ + + * @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 scale_of_closed_story extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = 0; + + public function calculate($row) + { + if($row->isParent == '1') return false; + if(empty($row->estimate)) return null; + + if($row->status == 'closed') $this->result += $row->estimate; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('value')); + return $this->filterByOptions($records, $options); + } +} From d5edee666daeb1739f91da76ee74540352d845c3 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 10 Jun 2025 14:32:01 +0800 Subject: [PATCH 4/5] + [task#144594,doing,0.4h] add changed story metric. --- .../system/scale/count_of_changed_story.php | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 module/metric/calc/system/scale/count_of_changed_story.php diff --git a/module/metric/calc/system/scale/count_of_changed_story.php b/module/metric/calc/system/scale/count_of_changed_story.php new file mode 100644 index 0000000000..ef89d3546e --- /dev/null +++ b/module/metric/calc/system/scale/count_of_changed_story.php @@ -0,0 +1,42 @@ + + * @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_changed_story extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = 0; + + public function calculate($row) + { + if(empty($row->changedDate) || $row->status == 'changing' || $row->status == 'reviewing') return false; + + if(!empty($row->executionStartDate) && !empty($row->executionEndDate) && $row->changedDate < $row->executionStartDate || $row->changedDate > $row->executionEndDate) return false; + $this->result ++; + } + + public function getResult($options = array()) + { + $records = array(array('value' => $this->result)); + return $this->filterByOptions($records, $options); + } +} From 2da9eaa597c5aad6bcea84efa6ce12b4862643c8 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 10 Jun 2025 14:32:07 +0800 Subject: [PATCH 5/5] + [task#144594,doing,0.4h] add changed story metric. --- .../system/scale/scale_of_changed_story.php | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 module/metric/calc/system/scale/scale_of_changed_story.php diff --git a/module/metric/calc/system/scale/scale_of_changed_story.php b/module/metric/calc/system/scale/scale_of_changed_story.php new file mode 100644 index 0000000000..4d176f3996 --- /dev/null +++ b/module/metric/calc/system/scale/scale_of_changed_story.php @@ -0,0 +1,45 @@ + + * @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 scale_of_changed_story extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = 0; + + public function calculate($row) + { + if($row->isParent == '1') return false; + if(empty($row->estimate)) return false; + + if(empty($row->changedDate) || $row->status == 'changing' || $row->status == 'reviewing') return false; + if(!empty($row->executionStartDate) && !empty($row->executionEndDate) && $row->changedDate < $row->executionStartDate || $row->changedDate > $row->executionEndDate) return false; + + $this->result += $row->estimate; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('value')); + return $this->filterByOptions($records, $options); + } +}