diff --git a/module/metric/calc/product/scale/count_of_daily_resolved_bug_in_product.php b/module/metric/calc/product/scale/count_of_daily_resolved_bug_in_product.php index 6528755bb2..9acb9e62ac 100755 --- a/module/metric/calc/product/scale/count_of_daily_resolved_bug_in_product.php +++ b/module/metric/calc/product/scale/count_of_daily_resolved_bug_in_product.php @@ -44,20 +44,7 @@ class count_of_daily_resolved_bug_in_product extends baseCalc public function getResult($options = array()) { - $records = array(); - foreach($this->result as $product => $years) - { - foreach($years as $year => $months) - { - foreach($months as $month => $days) - { - foreach($days as $day => $value) - { - $records[] = array('product' => $product, 'year' => $year, 'month' => $month, 'day' => $day, 'value' => $value); - } - } - } - } + $records = $this->getRecords(array('product', 'year', 'month', 'day', 'value')); return $this->filterByOptions($records, $options); } diff --git a/module/metric/calc/project/time/left_period_of_project.php b/module/metric/calc/project/time/left_period_of_project.php index e4a8f98be3..c8dd056513 100755 --- a/module/metric/calc/project/time/left_period_of_project.php +++ b/module/metric/calc/project/time/left_period_of_project.php @@ -52,3 +52,4 @@ class left_period_of_project extends baseCalc return $this->filterByOptions($records, $options); } } + diff --git a/module/metric/calc/system/scale/count_of_annual_closed_execution.php b/module/metric/calc/system/scale/count_of_annual_closed_execution.php index ab90a019d4..d4edc9af64 100755 --- a/module/metric/calc/system/scale/count_of_annual_closed_execution.php +++ b/module/metric/calc/system/scale/count_of_annual_closed_execution.php @@ -8,7 +8,7 @@ * 目的:scale * 度量名称:按系统统计的年度关闭执行数 * 单位:个 - * 描述:按系统统计的年度完成执行数是指在某年度已经关闭的执行数。该度量项反映了团队或组织在某年的工作效率和完成能力。较高的年度完成执行数表示团队或组织在完成任务方面表现出较高的效率,反之则可能需要审查工作流程和资源分配情况,以提高执行效率。 + * 描述:按系统统计的年度关闭执行数是指在关闭时间在某年的执行数。该度量项可以反映团队或组织在某年的工作效率。较高的年度关闭执行数可能表示团队或组织在完成任务方面表现出较高的效率,反之则可能需要审查工作流程和资源分配情况,以提高执行效率。 * 定义:所有的执行个数求和;关闭时间为某年;过滤已删除的执行; * * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net) diff --git a/module/metric/calc/system/scale/count_of_annual_finished_execution.php b/module/metric/calc/system/scale/count_of_annual_finished_execution.php new file mode 100644 index 0000000000..eb9c36ec2f --- /dev/null +++ b/module/metric/calc/system/scale/count_of_annual_finished_execution.php @@ -0,0 +1,46 @@ + + * @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_annual_finished_execution extends baseCalc +{ + public $dataset = 'getExecutions'; + + public $fieldList = array('t1.closedDate'); + + public $result = array(); + + public function calculate($row) + { + $closedDate = $row->closedDate; + if(empty($closedDate)) return false; + + $year = substr($closedDate, 0, 4); + if($year == '0000') return false; + + if(!isset($this->result[$year])) $this->result[$year] = 0; + $this->result[$year] += 1; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('year', 'value')); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/calc/system/scale/count_of_monthly_created_release.php b/module/metric/calc/system/scale/count_of_monthly_created_release.php index 0a09d1cd5b..aff2fe7653 100755 --- a/module/metric/calc/system/scale/count_of_monthly_created_release.php +++ b/module/metric/calc/system/scale/count_of_monthly_created_release.php @@ -45,14 +45,7 @@ class count_of_monthly_created_release extends baseCalc public function getResult($options = array()) { - $records = array(); - foreach($this->result as $year => $months) - { - foreach($months as $month => $value) - { - $records[] = array('year' => $year, 'month' => $month, 'value' => $value); - } - } + $records = $this->getRecords(array('year', 'month', 'value')); return $this->filterByOptions($records, $options); } } diff --git a/module/metric/calc/user/scale/count_of_assigned_bug_in_user.php b/module/metric/calc/user/scale/count_of_assigned_bug_in_user.php index f3c0926354..2ce92a601c 100755 --- a/module/metric/calc/user/scale/count_of_assigned_bug_in_user.php +++ b/module/metric/calc/user/scale/count_of_assigned_bug_in_user.php @@ -9,7 +9,7 @@ * 度量名称:按人员统计的待处理Bug数 * 单位:个 * 描述:按人员统计的待处理Bug数表示每个人待处理的Bug数量之和。反映了每个人需要处理的Bug数量上的规模。该数值越大,说明需要投入越多的时间解决Bug。 - * 定义:所有Bug个数求和;指派给为某人;过滤状态为已关闭的Bug;过滤已删除的Bug;过滤已删除产品的Bug; + * 定义:所有Bug个数求和 指派给为某人 过滤已删除的Bug 过滤已关闭的Bug 过滤已删除产品的Bug 不过滤影子产品; * * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net) * @author zhouxin @@ -20,7 +20,7 @@ */ class count_of_assigned_bug_in_user extends baseCalc { - public $dataset = 'getBugs'; + public $dataset = 'getBugsWithShadowProduct'; public $fieldList = array('t1.assignedTo'); diff --git a/module/metric/calc/user/scale/count_of_assigned_task_in_user.php b/module/metric/calc/user/scale/count_of_assigned_task_in_user.php index 98514b520b..5352ad94f2 100755 --- a/module/metric/calc/user/scale/count_of_assigned_task_in_user.php +++ b/module/metric/calc/user/scale/count_of_assigned_task_in_user.php @@ -37,7 +37,7 @@ class count_of_assigned_task_in_user extends baseCalc if(empty($assignedTo) || $assignedTo == 'closed') return false; if($status == 'closed' || $status == 'cancel') return false; - if($projectStatus == 'suspended' || $executionStatus == 'suspended') return false; + if($projectStatus == 'suspended' || $projectStatus == 'closed' || $executionStatus == 'suspended' || $executionStatus == 'closed') return false; if($mode == 'multi') { diff --git a/module/metric/calc/user/scale/count_of_delayed_task_in_user.php b/module/metric/calc/user/scale/count_of_delayed_task_in_user.php new file mode 100755 index 0000000000..54762cecbe --- /dev/null +++ b/module/metric/calc/user/scale/count_of_delayed_task_in_user.php @@ -0,0 +1,49 @@ + + * @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_delayed_task_in_user extends baseCalc +{ + public $dataset = 'getTasks'; + + public $fieldList = array('t1.assignedTo', 't1.deadline'); + + public $result = array(); + + public function calculate($row) + { + $nowDate = helper::now(); + $deadline = $row->deadline; + $assignedTo = $row->assignedTo; + + if(empty($deadline) || substr($deadline, 0 ,4) == '0000') return false; + if(strtotime($nowDate) <= strtotime($deadline)) return false; + + if(!isset($this->result[$assignedTo])) $this->result[$assignedTo] = 0; + $this->result[$assignedTo] += 1; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('user', 'value')); + return $this->filterByOptions($records, $options); + } +}