From 138e5e378df12d9344d2cb56fb3140c842d0233a Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:08:49 +0800 Subject: [PATCH 01/24] + [story#75286] init the count_of_daily_closed_bug_in_execution metric. --- .../count_of_daily_closed_bug_in_execution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php new file mode 100644 index 0000000000..b299c2a376 --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php @@ -0,0 +1,15 @@ +getRecords(array('execution', 'year', 'month', 'day')); + return $this->filterByOptions($records, $options); + } +} From 9918d0216bc2192cdf9b1204d4b17934aac8e28d Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:09:17 +0800 Subject: [PATCH 02/24] + [story#75286] add the calculate for count_of_daily_closed_bug_in_execution metric. --- .../count_of_daily_closed_bug_in_execution.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php index b299c2a376..b7c945a0ac 100644 --- a/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php @@ -7,6 +7,24 @@ class count_of_daily_closed_bug_in_execution extends baseCalc public $result = array(); + public function calculate($row) + { + if($row->status != 'closed') return false; + + $year = $this->getYear($row->closedDate); + if(!$year) return false; + + $date = substr($row->closedDate, 0, 10); + list($year, $month, $day) = explode('-', $date); + + if(!isset($this->result[$row->execution])) $this->result[$row->execution] = array(); + if(!isset($this->result[$row->execution][$year])) $this->result[$row->execution][$year] = array(); + if(!isset($this->result[$row->execution][$year][$month])) $this->result[$row->execution][$year][$month] = array(); + if(!isset($this->result[$row->execution][$year][$month][$day])) $this->result[$row->execution][$year][$month][$day] = 0; + + $this->result[$row->execution][$year][$month][$day] ++; + } + public function getResult($options = array()) { $records = $this->getRecords(array('execution', 'year', 'month', 'day')); From 6e41da280c79199fc6c456c68dea2cc676228c97 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:09:36 +0800 Subject: [PATCH 03/24] + [story#75286] add the comments for count_of_daily_closed_bug_in_execution metric. --- ...count_of_daily_closed_bug_in_execution.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php index b7c945a0ac..ad1e24885d 100644 --- a/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php @@ -1,4 +1,23 @@ + * @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_daily_closed_bug_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; From 0e7a4ebbdfb4960a146f9ac95cd7fb37f177144d Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:10:12 +0800 Subject: [PATCH 04/24] + [story#75286] init the count_of_daily_created_bug_in_execution metric. --- .../count_of_daily_created_bug_in_execution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php new file mode 100644 index 0000000000..2a9c7afcf3 --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php @@ -0,0 +1,15 @@ +getRecords(array('execution', 'year', 'month', 'day', 'value')); + return $this->filterByOptions($records, $options); + } +} From 974a8fb9dfe77bb9cfcc33cca9ad2bba378524e1 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:10:34 +0800 Subject: [PATCH 05/24] + [story#75286] add the calculate for count_of_daily_created_bug_in_execution metric. --- .../count_of_daily_created_bug_in_execution.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php index 2a9c7afcf3..a6d5363a3d 100644 --- a/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php @@ -7,6 +7,22 @@ class count_of_daily_created_bug_in_execution extends baseCalc public $result = array(); + public function calculate($row) + { + $year = $this->getYear($row->openedDate); + if(!$year) return false; + + $date = substr($row->openedDate, 0, 10); + list($year, $month, $day) = explode('-', $date); + + if(!isset($this->result[$row->execution])) $this->result[$row->execution] = array(); + if(!isset($this->result[$row->execution][$year])) $this->result[$row->execution][$year] = array(); + if(!isset($this->result[$row->execution][$year][$month])) $this->result[$row->execution][$year][$month] = array(); + if(!isset($this->result[$row->execution][$year][$month][$day])) $this->result[$row->execution][$year][$month][$day] = 0; + + $this->result[$row->execution][$year][$month][$day] ++; + } + public function getResult($options = array()) { $records = $this->getRecords(array('execution', 'year', 'month', 'day', 'value')); From 319ac1d5914bdad1b4500fe8da0cbf037d1b0c0f Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:10:54 +0800 Subject: [PATCH 06/24] + [story#75286] add the comments for count_of_daily_created_bug_in_execution metric. --- ...ount_of_daily_created_bug_in_execution.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php index a6d5363a3d..0a2e8f234f 100644 --- a/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php @@ -1,4 +1,23 @@ + * @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_daily_created_bug_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; From 5b4922c1e4d1e22ccf26728b0295f80c33527da0 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:11:20 +0800 Subject: [PATCH 07/24] + [story#75286] init the count_of_daily_resolved_bug_in_execution metric. --- .../count_of_daily_resolved_bug_in_execution.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php new file mode 100644 index 0000000000..92c1038ce6 --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php @@ -0,0 +1,16 @@ +getRecords(array('execution', 'year', 'month', 'day', 'value')); + + return $this->filterByOptions($records, $options); + } +} From 6924b5e21283d47e00420bd314d8427ef2f14024 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:11:45 +0800 Subject: [PATCH 08/24] + [story#75286] add the calculate for count_of_daily_resolved_bug_in_execution metric. --- ...ount_of_daily_resolved_bug_in_execution.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php index 92c1038ce6..84b73850e8 100644 --- a/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php @@ -7,6 +7,24 @@ class count_of_daily_resolved_bug_in_execution extends baseCalc public $result = array(); + public function calculate($row) + { + if($row->status == 'active') return false; + + $year = $this->getYear($row->resolvedDate); + if(!$year) return false; + + $date = substr($row->resolvedDate, 0, 10); + list($year, $month, $day) = explode('-', $date); + + if(!isset($this->result[$row->execution])) $this->result[$row->execution] = array(); + if(!isset($this->result[$row->execution][$year])) $this->result[$row->execution][$year] = array(); + if(!isset($this->result[$row->execution][$year][$month])) $this->result[$row->execution][$year][$month] = array(); + if(!isset($this->result[$row->execution][$year][$month][$day])) $this->result[$row->execution][$year][$month][$day] = 0; + + $this->result[$row->execution][$year][$month][$day] ++; + } + public function getResult($options = array()) { $records = $this->getRecords(array('execution', 'year', 'month', 'day', 'value')); From f49210218a67d10a64ed1159dcba0e0defde35d6 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:12:14 +0800 Subject: [PATCH 09/24] + [story#75286] add the comments for count_of_daily_resolved_bug_in_execution metric. --- ...unt_of_daily_resolved_bug_in_execution.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php index 84b73850e8..ceebdba8b4 100644 --- a/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php @@ -1,4 +1,23 @@ + * @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_daily_resolved_bug_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; From ecbc4ed32a10540e83c0540b42fb50fa341e73ca Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:17:40 +0800 Subject: [PATCH 10/24] + [story#75285] init the count_of_activated_bug_in_execution metric. --- .../scale/count_of_activated_bug_in_execution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php new file mode 100644 index 0000000000..08c1770972 --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php @@ -0,0 +1,15 @@ +getRecords(array('execution', 'value')); + return $this->filterByOptions($records, $options); + } +} From bbea45768165dab75e1b3eb26158f0b626bdae54 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:17:59 +0800 Subject: [PATCH 11/24] + [story#75286] add the calculate for count_of_activated_bug_in_execution metric. --- .../scale/count_of_activated_bug_in_execution.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php index 08c1770972..5b996dd529 100644 --- a/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php @@ -7,6 +7,16 @@ class count_of_activated_bug_in_execution extends baseCalc public $result = array(); + public function calculate($row) + { + $execution = $row->execution; + $status = $row->status; + + if(!isset($this->result[$execution])) $this->result[$execution] = 0; + + if($status == 'active') $this->result[$execution] += 1; + } + public function getResult($options = array()) { $records = $this->getRecords(array('execution', 'value')); From cf8f6adfb8a5cfd8526af8b1819efeaadf133fa2 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:18:24 +0800 Subject: [PATCH 12/24] + [story#75286] add the comments for count_of_activated_bug_in_execution metric. --- .../count_of_activated_bug_in_execution.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php index 5b996dd529..245e643dfe 100644 --- a/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_activated_bug_in_execution.php @@ -1,4 +1,23 @@ + * @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_activated_bug_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; From 65101188b195da098d77722e34483a4bd0fb3d0e Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:21:19 +0800 Subject: [PATCH 13/24] + [story#75279] init the count_of_bug_in_pri_in_execution metric. --- .../scale/count_of_bug_in_pri_in_execution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php new file mode 100644 index 0000000000..20aa0bf79a --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php @@ -0,0 +1,15 @@ +result[$row->pri])) $this->result[$row->pri] = array(); + $this->result[$row->pri][$row->id] = $row->id; + } +} From 09c25dfcec211077de99ae89fb808def0ef3b261 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:22:01 +0800 Subject: [PATCH 14/24] + [story#75279] add the comments for the count_of_bug_in_pri_in_execution metric. --- .../count_of_bug_in_pri_in_execution.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php index 20aa0bf79a..0085f77bd9 100644 --- a/module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_bug_in_pri_in_execution.php @@ -1,4 +1,23 @@ + * @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_bug_in_pri_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; @@ -12,4 +31,17 @@ class count_of_bug_in_pri_in_execution extends baseCalc if(!isset($this->result[$row->pri])) $this->result[$row->pri] = array(); $this->result[$row->pri][$row->id] = $row->id; } + + public function getResult($options = array()) + { + foreach($this->result as $pri => $bugs) + { + if(!is_array($bugs)) continue; + + $this->result[$pri] = count($bugs); + } + + $records = $this->getRecords(array('pri', 'value')); + return $this->filterByOptions($records, $options); + } } From d7c97b902b4080c3d0c02bb8024c3ce12b5fb927 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:22:27 +0800 Subject: [PATCH 15/24] + [story#75279] init the count_of_bug_in_resolution_in_execution metric. --- .../count_of_bug_in_resolution_in_execution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php new file mode 100644 index 0000000000..14b759fb5b --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php @@ -0,0 +1,15 @@ +result[$row->resolution])) $this->result[$row->resolution] = array(); + $this->result[$row->resolution][$row->id] = $row->id; + } +} From 1edbcdf01ac1b906f65bd27d612757038b00ce97 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:22:44 +0800 Subject: [PATCH 16/24] + [story#75279] add the getResult for the count_of_bug_in_resolution_in_execution metric. --- .../count_of_bug_in_resolution_in_execution.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php index 14b759fb5b..ad843d3066 100644 --- a/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php @@ -12,4 +12,17 @@ class count_of_bug_in_resolution_in_execution extends baseCalc if(!isset($this->result[$row->resolution])) $this->result[$row->resolution] = array(); $this->result[$row->resolution][$row->id] = $row->id; } + + public function getResult($options = array()) + { + foreach($this->result as $resolution => $bugs) + { + if(!is_array($bugs)) continue; + + $this->result[$resolution] = count($bugs); + } + + $records = $this->getRecords(array('resolution', 'value')); + return $this->filterByOptions($records, $options); + } } From ae552b545524a6f3976be1562a247587db9199fc Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:23:08 +0800 Subject: [PATCH 17/24] + [story#75279] add the comments for the count_of_bug_in_resolution_in_execution metric. --- ...ount_of_bug_in_resolution_in_execution.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php index ad843d3066..bddc3f6c96 100644 --- a/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_bug_in_resolution_in_execution.php @@ -1,4 +1,23 @@ + * @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_bug_in_resolution_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; From 994835e38de424de08393d6db335029c6013bf14 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:24:04 +0800 Subject: [PATCH 18/24] + [story#75279] init the count_of_bug_in_severity_in_execution metric. --- .../count_of_bug_in_severity_in_execution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php new file mode 100644 index 0000000000..1c633b9157 --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php @@ -0,0 +1,15 @@ +result[$row->severity])) $this->result[$row->severity] = array(); + $this->result[$row->severity][$row->id] = $row->id; + } +} From f4e36432ae4169dfa097fc2c3959a2df0261b754 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:24:42 +0800 Subject: [PATCH 19/24] + [story#75279] add the getResult for the count_of_bug_in_severity_in_execution metric. --- .../scale/count_of_bug_in_severity_in_execution.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php index 1c633b9157..ffcf2ae450 100644 --- a/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php @@ -12,4 +12,17 @@ class count_of_bug_in_severity_in_execution extends baseCalc if(!isset($this->result[$row->severity])) $this->result[$row->severity] = array(); $this->result[$row->severity][$row->id] = $row->id; } + + public function getResult($options = array()) + { + foreach($this->result as $severity => $bugs) + { + if(!is_array($bugs)) continue; + + $this->result[$severity] = count($bugs); + } + + $records = $this->getRecords(array('severity', 'value')); + return $this->filterByOptions($records, $options); + } } From 68855ced294a95c52a956ec78fa80e0cbd0a9631 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:25:11 +0800 Subject: [PATCH 20/24] + [story#75279] add the comments for the count_of_bug_in_severity_in_execution metric. --- .../count_of_bug_in_severity_in_execution.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php index ffcf2ae450..9d1348d822 100644 --- a/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_bug_in_severity_in_execution.php @@ -1,4 +1,23 @@ + * @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_bug_in_severity_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; From 74773cc488c23f8a3c83e706efac5ebb894552fc Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:25:37 +0800 Subject: [PATCH 21/24] + [story#75279] init the count_of_bug_in_type_in_execution metric. --- .../scale/count_of_bug_in_type_in_execution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php diff --git a/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php new file mode 100644 index 0000000000..58268521de --- /dev/null +++ b/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php @@ -0,0 +1,15 @@ +result[$row->type])) $this->result[$row->type] = array(); + $this->result[$row->type][$row->id] = $row->id; + } +} From bc417466c4e56729799885ceff714235ba36dd07 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:25:55 +0800 Subject: [PATCH 22/24] + [story#75279] add the getResult for the count_of_bug_in_type_in_execution metric. --- .../scale/count_of_bug_in_type_in_execution.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php index 58268521de..28e09cdef4 100644 --- a/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php @@ -12,4 +12,17 @@ class count_of_bug_in_type_in_execution extends baseCalc if(!isset($this->result[$row->type])) $this->result[$row->type] = array(); $this->result[$row->type][$row->id] = $row->id; } + + public function getResult($options = array()) + { + foreach($this->result as $type => $bugs) + { + if(!is_array($bugs)) continue; + + $this->result[$type] = count($bugs); + } + + $records = $this->getRecords(array('type', 'value')); + return $this->filterByOptions($records, $options); + } } From 0c54f84a7bfe62965cc10b429c54d749c2622f43 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 09:26:19 +0800 Subject: [PATCH 23/24] + [story#75279] add the comments for the count_of_bug_in_type_in_execution metric. --- .../count_of_bug_in_type_in_execution.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php b/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php index 28e09cdef4..3bee4e3180 100644 --- a/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_bug_in_type_in_execution.php @@ -1,4 +1,23 @@ + * @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_bug_in_type_in_execution extends baseCalc { public $dataset = 'getExecutionBugs'; From 5e59afe1c3856f2985f97bef60d1c1a1219efd47 Mon Sep 17 00:00:00 2001 From: wangzemei Date: Fri, 6 Jun 2025 10:40:53 +0800 Subject: [PATCH 24/24] * [story#75273] extract method for calculating daily incremental data. --- module/metric/calc.class.php | 35 +++++++++++++++++++ ...count_of_daily_closed_bug_in_execution.php | 16 ++------- ...ount_of_daily_created_bug_in_execution.php | 14 ++------ ...unt_of_daily_resolved_bug_in_execution.php | 16 ++------- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/module/metric/calc.class.php b/module/metric/calc.class.php index 89545291f6..94daae2f47 100644 --- a/module/metric/calc.class.php +++ b/module/metric/calc.class.php @@ -729,4 +729,39 @@ class baseCalc return $executions; } + + /** + * 检查日期。 + * Validate date. + * + * @param string $date + * @access public + * @return bool + */ + public function validateDate(string $date): bool + { + return $this->getYear($date) !== false; + } + + /** + * 按日期递增计数。 + * Count incrementally by date. + * + * @param int $dataID + * @param string $date + * @access public + * @return void + */ + public function incrementDateCount(int $dataID, string $date) + { + $date = substr($date, 0, 10); + list($year, $month, $day) = explode('-', $date); + + if(!isset($this->result[$dataID])) $this->result[$dataID] = array(); + if(!isset($this->result[$dataID][$year])) $this->result[$dataID][$year] = array(); + if(!isset($this->result[$dataID][$year][$month])) $this->result[$dataID][$year][$month] = array(); + if(!isset($this->result[$dataID][$year][$month][$day])) $this->result[$dataID][$year][$month][$day] = 0; + + $this->result[$dataID][$year][$month][$day]++; + } } diff --git a/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php index ad1e24885d..9210cca76c 100644 --- a/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_closed_bug_in_execution.php @@ -28,20 +28,8 @@ class count_of_daily_closed_bug_in_execution extends baseCalc public function calculate($row) { - if($row->status != 'closed') return false; - - $year = $this->getYear($row->closedDate); - if(!$year) return false; - - $date = substr($row->closedDate, 0, 10); - list($year, $month, $day) = explode('-', $date); - - if(!isset($this->result[$row->execution])) $this->result[$row->execution] = array(); - if(!isset($this->result[$row->execution][$year])) $this->result[$row->execution][$year] = array(); - if(!isset($this->result[$row->execution][$year][$month])) $this->result[$row->execution][$year][$month] = array(); - if(!isset($this->result[$row->execution][$year][$month][$day])) $this->result[$row->execution][$year][$month][$day] = 0; - - $this->result[$row->execution][$year][$month][$day] ++; + if($row->status != 'closed' || !$this->validateDate($row->closedDate)) return false; + $this->incrementDateCount($row->execution, $row->closedDate); } public function getResult($options = array()) diff --git a/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php index 0a2e8f234f..a7c1f43708 100644 --- a/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_created_bug_in_execution.php @@ -28,18 +28,8 @@ class count_of_daily_created_bug_in_execution extends baseCalc public function calculate($row) { - $year = $this->getYear($row->openedDate); - if(!$year) return false; - - $date = substr($row->openedDate, 0, 10); - list($year, $month, $day) = explode('-', $date); - - if(!isset($this->result[$row->execution])) $this->result[$row->execution] = array(); - if(!isset($this->result[$row->execution][$year])) $this->result[$row->execution][$year] = array(); - if(!isset($this->result[$row->execution][$year][$month])) $this->result[$row->execution][$year][$month] = array(); - if(!isset($this->result[$row->execution][$year][$month][$day])) $this->result[$row->execution][$year][$month][$day] = 0; - - $this->result[$row->execution][$year][$month][$day] ++; + if(!$this->validateDate($row->openedDate)) return false; + $this->incrementDateCount($row->execution, $row->openedDate); } public function getResult($options = array()) diff --git a/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php index ceebdba8b4..86036e1f74 100644 --- a/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php +++ b/module/metric/calc/execution/scale/count_of_daily_resolved_bug_in_execution.php @@ -28,20 +28,8 @@ class count_of_daily_resolved_bug_in_execution extends baseCalc public function calculate($row) { - if($row->status == 'active') return false; - - $year = $this->getYear($row->resolvedDate); - if(!$year) return false; - - $date = substr($row->resolvedDate, 0, 10); - list($year, $month, $day) = explode('-', $date); - - if(!isset($this->result[$row->execution])) $this->result[$row->execution] = array(); - if(!isset($this->result[$row->execution][$year])) $this->result[$row->execution][$year] = array(); - if(!isset($this->result[$row->execution][$year][$month])) $this->result[$row->execution][$year][$month] = array(); - if(!isset($this->result[$row->execution][$year][$month][$day])) $this->result[$row->execution][$year][$month][$day] = 0; - - $this->result[$row->execution][$year][$month][$day] ++; + if($row->status == 'active' || !$this->validateDate($row->resolvedDate)) return false; + $this->incrementDateCount($row->execution, $row->resolvedDate); } public function getResult($options = array())