Merge branch feature/task-report of zentao/zentaopms (#10296)
This commit is contained in:
@@ -4802,3 +4802,45 @@ $config->bi->builtin->metrics[] = array
|
||||
'desc' => '指在测试阶段发现的缺陷数量与需求规模的比值。它反映了代码或系统的质量状况,用于评估开发过程的质量以及测试的有效性。',
|
||||
'definition' => "按月统计的已发布研发需求平均缺陷密度 = sum ( 当月发布的研发需求关联的Bug总数 ) / 当月发布的研发需求的规模总数\n当月发布的研发需求,是统计当月阶段状态为已发布、已关闭关闭原因为已完成的研发需求,过滤已删除的研发需求,次月过滤已统计过的研发需求。\n当月发布的研发需求关联的Bug总数,是统计当月发布的每个研发需求关联Bug,过滤已删除的bug。"
|
||||
);
|
||||
|
||||
$config->bi->builtin->metrics[] = array
|
||||
(
|
||||
'name' => '按执行统计的执行关闭时开发任务完成率',
|
||||
'alias' => '执行关闭时开发任务完成率',
|
||||
'code' => 'rate_of_finished_dev_task_in_execution_when_closing',
|
||||
'purpose' => 'rate',
|
||||
'scope' => 'execution',
|
||||
'object' => 'task',
|
||||
'unit' => 'percentage',
|
||||
'dateType' => 'nodate',
|
||||
'desc' => '按执行统计的开发任务按计划完成率是指执行时已完成的开发任务数与执行开始时计划的开发任务数的比率。该度量项反映了团队能否按期完成规划的开发任务,可以帮助团队识别执行中存在的潜在问题。',
|
||||
'definition' => "复用:按执行统计的执行关闭时已完成的开发任务数、按执行统计的开发任务数,公式:按执行统计的执行关闭时已完成的开发任务数÷按执行统计的开发任务数。"
|
||||
);
|
||||
|
||||
$config->bi->builtin->metrics[] = array
|
||||
(
|
||||
'name' => '按执行统计的开发任务数',
|
||||
'alias' => '开发任务数',
|
||||
'code' => 'count_of_dev_task_in_execution',
|
||||
'purpose' => 'scale',
|
||||
'scope' => 'execution',
|
||||
'object' => 'task',
|
||||
'unit' => 'count',
|
||||
'dateType' => 'nodate',
|
||||
'desc' => '按执行统计的开发任务数是指执行中任务类型为开发的任务数求和。该度量项反映了执行中开发的工作量,可以帮助团队进行开发资源调配。',
|
||||
'definition' => "执行中满足以下条件的任务个数求和,条件是:任务类型为开发,过滤已删除的任务,过滤已删除的执行,过滤已删除的项目。"
|
||||
);
|
||||
|
||||
$config->bi->builtin->metrics[] = array
|
||||
(
|
||||
'name' => '按执行统计的执行关闭时已完成的开发任务数',
|
||||
'alias' => '执行关闭时已完成的开发任务数',
|
||||
'code' => 'count_of_finished_dev_task_in_execution_when_closing',
|
||||
'purpose' => 'scale',
|
||||
'scope' => 'execution',
|
||||
'object' => 'task',
|
||||
'unit' => 'count',
|
||||
'dateType' => 'nodate',
|
||||
'desc' => '按执行统计的执行关闭时已完成开发任务数表示执行关闭时任务状态为已完成的开发任务个数求和。该度量项反映了执行关闭时开发人员完成的开发任务个数,可以评估执行中开发人员的实际工作量和开发效率。',
|
||||
'definition' => "执行关闭时执行中满足以下条件的开发任务个数求和,条件是:任务类型为开发,状态为已完成或已关闭且关闭原因为已完成,过滤已删除的任务,过滤已删除的执行,过滤已删除的项目。"
|
||||
);
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* 按执行统计的执行关闭时开发任务完成率
|
||||
* Scale of story in execution when starting.
|
||||
*
|
||||
* 范围:execution
|
||||
* 对象:task
|
||||
* 目的:rate
|
||||
* 度量名称:按执行统计的执行关闭时开发任务完成率
|
||||
* 单位:%
|
||||
* 描述:按执行统计的开发任务按计划完成率是指执行时已完成的开发任务数与执行开始时计划的开发任务数的比率。该度量项反映了团队能否按期完成规划的开发任务,可以帮助团队识别执行中存在的潜在问题。
|
||||
* 复用:按执行统计的执行关闭时已完成的开发任务数、按执行统计的开发任务数,公式:按执行统计的执行关闭时已完成的开发任务数÷按执行统计的开发任务数。
|
||||
*
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @author qixinzhi <qixinzhi@zentao.com>
|
||||
* @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 rate_of_finished_dev_task_in_execution_when_closing extends baseCalc
|
||||
{
|
||||
public $initRecord = false;
|
||||
|
||||
public $reuse = true;
|
||||
|
||||
public $reuseMetrics = array('allTask' => 'count_of_dev_task_in_execution', 'finishedTask' => 'count_of_finished_dev_task_in_execution_when_closing');
|
||||
|
||||
public $reuseRule = '{finishedTask} / {allTask}';
|
||||
|
||||
public $result = array();
|
||||
|
||||
public function calculate($metrics)
|
||||
{
|
||||
$allTask = $metrics['allTask'];
|
||||
$finishedTask = $metrics['finishedTask'];
|
||||
if(empty($allTask) || empty($finishedTask)) return false;
|
||||
|
||||
$all = array_merge($allTask, $finishedTask);
|
||||
$allTask = $this->generateUniqueKey($allTask);
|
||||
$finishedTask = $this->generateUniqueKey($finishedTask);
|
||||
|
||||
$executions = array_column($all, 'execution', 'execution');
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if(!isset($allTask[$execution])) continue;
|
||||
|
||||
$allTaskItem = $allTask[$execution];
|
||||
$finishedTaskItem = isset($finishedTask[$execution]) ? $finishedTask[$execution] : 0;
|
||||
$this->result[$execution] = $allTaskItem == 0 ? 0 : round($finishedTaskItem / $allTaskItem, 4);
|
||||
}
|
||||
}
|
||||
|
||||
public function getResult($options = array())
|
||||
{
|
||||
$records = array();
|
||||
foreach($this->result as $execution => $value) $records[] = array('execution' => $execution, 'value' => $value);
|
||||
return $this->filterByOptions($records, $options);
|
||||
}
|
||||
|
||||
public function generateUniqueKey($records)
|
||||
{
|
||||
$uniqueKeyRecords = array();
|
||||
foreach($records as $record)
|
||||
{
|
||||
$key = $record['execution'];
|
||||
$uniqueKeyRecords[$key] = $record['value'];
|
||||
}
|
||||
|
||||
return $uniqueKeyRecords;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* 按执行统计的开发任务数
|
||||
* Scale of dev task in execution.
|
||||
*
|
||||
* 范围:execution
|
||||
* 对象:task
|
||||
* 目的:scale
|
||||
* 度量名称:按执行统计的开发任务数
|
||||
* 单位:count
|
||||
* 描述:按执行统计的开发任务数是指执行中任务类型为开发的任务数求和。该度量项反映了执行中开发的工作量,可以帮助团队进行开发资源调配。
|
||||
* 复用:执行中满足以下条件的任务个数求和,条件是:任务类型为开发,过滤已删除的任务,过滤已删除的执行,过滤已删除的项目。
|
||||
*
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @author qixinzhi <qixinzhi@zentao.com>
|
||||
* @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_dev_task_in_execution extends baseCalc
|
||||
{
|
||||
public $dataset = 'getTasks';
|
||||
|
||||
public $fieldList = array('t1.type', 't1.execution');
|
||||
|
||||
public $result = array();
|
||||
|
||||
public function calculate($row)
|
||||
{
|
||||
if($row->type == 'devel')
|
||||
{
|
||||
if(!isset($this->result[$row->execution])) $this->result[$row->execution] = 0;
|
||||
$this->result[$row->execution] ++;
|
||||
}
|
||||
}
|
||||
|
||||
public function getResult($options = array())
|
||||
{
|
||||
$records = $this->getRecords(array('execution', 'value'));
|
||||
return $this->filterByOptions($records, $options);
|
||||
}
|
||||
}
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* 按执行统计的执行关闭时已完成的开发任务数。
|
||||
* Count of finished devel task in execution when closing.
|
||||
*
|
||||
* 范围:execution
|
||||
* 对象:task
|
||||
* 目的:scale
|
||||
* 度量名称:按执行统计的执行关闭时完成的开发任务数
|
||||
* 单位:个
|
||||
* 描述:按执行统计的执行关闭时已完成开发任务数表示执行关闭时任务状态为已完成的开发任务个数求和。该度量项反映了执行关闭时开发人员完成的开发任务个数,可以评估执行中开发人员的实际工作量和开发效率。
|
||||
* 定义:执行关闭时执行中满足以下条件的开发任务个数求和,条件是:任务类型为开发,状态为已完成或已关闭且关闭原因为已完成,过滤已删除的任务,过滤已删除的执行,过滤已删除的项目。
|
||||
*
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @author qixinzhi <qixinzhi@zentao.com>
|
||||
* @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_finished_dev_task_in_execution_when_closing extends baseCalc
|
||||
{
|
||||
public $dataset = 'getTasks';
|
||||
|
||||
public $fieldList = array('t1.type', 't1.status', 't1.closedReason', 't1.finishedDate', 't1.closedDate', 't1.execution', 't2.closedDate AS executionClosedDate');
|
||||
|
||||
public $result = array();
|
||||
|
||||
public $initRecord = false;
|
||||
|
||||
public function calculate($row)
|
||||
{
|
||||
$finishedDate = $this->isDate($row->finishedDate) ? $row->finishedDate : $row->closedDate;
|
||||
if(!helper::isZeroDate($row->executionClosedDate))
|
||||
{
|
||||
if($row->type == 'devel' && ($row->status == 'done' || $row->status == 'closed' && $row->closedReason == 'done') && $finishedDate <= $row->executionClosedDate)
|
||||
{
|
||||
if(!isset($this->result[$row->execution])) $this->result[$row->execution] = 0;
|
||||
$this->result[$row->execution] ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getResult($options = array())
|
||||
{
|
||||
$executions = $this->getExecutions();
|
||||
$closedExecutions = array_filter($executions, function($execution) { return $execution->status === 'closed'; });
|
||||
foreach($closedExecutions as $executionID => $executionInfo)
|
||||
{
|
||||
if(!isset($this->result[$executionID])) $this->result[$executionID] = 0;
|
||||
}
|
||||
|
||||
$records = $this->getRecords(array('execution', 'value'));
|
||||
return $this->filterByOptions($records, $options);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=count_of_dev_task_in_execution
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试分组数。 @10
|
||||
- 测试执行11的开发任务数。第0条的value属性 @26
|
||||
- 测试执行12的开发任务数。第0条的value属性 @15
|
||||
- 测试执行13的开发任务数。第0条的value属性 @11
|
||||
- 测试不存在执行的开发任务数。 @0
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 7) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 4) . '/lib/calc.unittest.class.php';
|
||||
|
||||
zendata('project')->loadYaml('project_status', true, 4)->gen(10);
|
||||
zendata('project')->loadYaml('execution', true, 4)->gen(20, false);
|
||||
zendata('task')->loadYaml('task', true, 4)->gen(1000);
|
||||
|
||||
$metric = new metricTest();
|
||||
$calc = $metric->calcMetric(__FILE__);
|
||||
|
||||
r(count($calc->getResult())) && p('') && e('10'); // 测试分组数。
|
||||
r($calc->getResult(array('execution' => 11))) && p('0:value') && e('26'); // 测试执行11的开发任务数。
|
||||
r($calc->getResult(array('execution' => 12))) && p('0:value') && e('15'); // 测试执行12的开发任务数。
|
||||
r($calc->getResult(array('execution' => 13))) && p('0:value') && e('11'); // 测试执行13的开发任务数。
|
||||
r($calc->getResult(array('execution' => 110))) && p('') && e('0'); // 测试不存在执行的开发任务数。
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=count_of_finished_dev_task_in_execution_when_closing
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试分组数。 @1
|
||||
- 测试执行11开始时的开发任务数。第0条的value属性 @0
|
||||
- 测试执行12开始时的开发任务数。第0条的value属性 @0
|
||||
- 测试执行13开始时的开发任务数。第0条的value属性 @0
|
||||
- 测试不存在执行开始时的开发任务数。 @0
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 7) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 4) . '/lib/calc.unittest.class.php';
|
||||
|
||||
zendata('project')->loadYaml('project_status', true, 4)->gen(10);
|
||||
zendata('project')->loadYaml('execution', true, 4)->gen(20, false);
|
||||
zendata('task')->loadYaml('task', true, 4)->gen(500);
|
||||
|
||||
$metric = new metricTest();
|
||||
$calc = $metric->calcMetric(__FILE__);
|
||||
|
||||
r(count($calc->getResult())) && p('') && e('4'); // 测试分组数。
|
||||
r($calc->getResult(array('execution' => 11))) && p('0:value') && e('0'); // 测试执行11开始时的开发任务数。
|
||||
r($calc->getResult(array('execution' => 12))) && p('0:value') && e('0'); // 测试执行12开始时的开发任务数。
|
||||
r($calc->getResult(array('execution' => 13))) && p('0:value') && e('0'); // 测试执行13开始时的开发任务数。
|
||||
r($calc->getResult(array('execution' => 110))) && p('') && e('0'); // 测试不存在执行开始时的开发任务数。
|
||||
Reference in New Issue
Block a user