+[task#124853,done,2.5h].
This commit is contained in:
@@ -4439,6 +4439,20 @@ $config->bi->builtin->metrics[] = array
|
||||
'definition' => "执行中新增Bug个数求和\n解决方案为已解决,延期处理和不予解决或状态为激活\n过滤已删除的Bug\n过滤已删除的执行\n过滤已删除的项目\n过滤已删除的产品\n"
|
||||
);
|
||||
|
||||
$config->bi->builtin->metrics[] = array
|
||||
(
|
||||
'name' => '按执行统计的执行关闭时已交付的研发需求规模数',
|
||||
'alias' => '执行关闭时已交付研发需求规模数',
|
||||
'code' => 'scale_of_delivered_story_in_closed_execution',
|
||||
'purpose' => 'scale',
|
||||
'scope' => 'execution',
|
||||
'object' => 'story',
|
||||
'unit' => 'hour',
|
||||
'dateType' => 'nodate',
|
||||
'desc' => '按执行统计的执行关闭时已交付研发需求规模数表示执行关闭时需求阶段为已发布或状态为已关闭且关闭原因为已完成的研发需求的规模。该度量项反映了执行结束时能够交付给用户的研发需求的规模,可以用于评估执行团队的研发需求交付能力。',
|
||||
'definition' => "执行关闭时,满足以下条件的执行中研发需求规模数求和,条件是:所处阶段为已发布或关闭原因为已完成\n过滤已删除的研发需求\n过滤已删除的执行\n过滤已删除的项目\n过滤已删除的产品\n"
|
||||
);
|
||||
|
||||
$config->bi->builtin->metrics[] = array
|
||||
(
|
||||
'name' => '按执行统计的来源Bug的任务消耗工时占比',
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* 按执行统计的执行关闭时已交付的研发需求规模数
|
||||
* Scale of story in execution.
|
||||
*
|
||||
* 范围:execution
|
||||
* 对象:story
|
||||
* 目的:scale
|
||||
* 度量名称:按执行统计的执行关闭时已交付的研发需求规模数
|
||||
* 单位:小时
|
||||
* 描述:按执行统计的执行关闭时已交付研发需求规模数表示执行关闭时需求阶段为已发布或状态为已关闭且关闭原因为已完成的研发需求的规模。该度量项反映了执行结束时能够交付给用户的研发需求的规模,可以用于评估执行团队的研发需求交付能力。
|
||||
* 定义:执行关闭时,满足以下条件的执行中研发需求规模数求和,条件是:所处阶段为已发布或关闭原因为已完成,过滤已删除的研发需求,过滤已删除的执行,过滤已删除的项目,过滤已删除的产品。
|
||||
*
|
||||
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @author songchenxuan <songchenxuan@chandao.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 scale_of_delivered_story_in_closed_execution extends baseCalc
|
||||
{
|
||||
public $dataset = 'getDevStoriesWithExecution';
|
||||
|
||||
public $fieldList = array('t4.id as execution', 't1.id', 't1.estimate', 't4.closedDate as executionClosed', 't1.closedDate as storyClosedDate', 't1.releasedDate as storyReleasedDate', 't1.stage', 't1.closedReason');
|
||||
|
||||
public $result = array();
|
||||
|
||||
public function calculate($row)
|
||||
{
|
||||
// 如果项目的关闭时间大于等于需求的发布时间
|
||||
$condition1 = (!helper::isZeroDate($row->executionClosed) && !helper::isZeroDate($row->storyReleasedDate) && $row->executionClosed >= $row->storyReleasedDate);
|
||||
// 如果项目的关闭时间大于等于需求的关闭时间且需求的关闭原因为已完成
|
||||
$condition2 = (!helper::isZeroDate($row->executionClosed) && !helper::isZeroDate($row->storyClosedDate) && $row->executionClosed >= $row->storyClosedDate && $row->closedReason == 'done');
|
||||
|
||||
if($condition1 || $condition2)
|
||||
{
|
||||
if(!isset($this->result[$row->execution])) $this->result[$row->execution] = 0;
|
||||
$this->result[$row->execution] += $row->estimate;
|
||||
}
|
||||
}
|
||||
|
||||
public function getResult($options = array())
|
||||
{
|
||||
$records = $this->getRecords(array('execution', 'value'));
|
||||
return $this->filterByOptions($records, $options);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=scale_of_delivered_story_in_closed_execution
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试分组数。 @6
|
||||
- 测试项目4。第0条的value属性 @10
|
||||
|
||||
*/
|
||||
include dirname(__FILE__, 7) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 4) . '/lib/calc.unittest.class.php';
|
||||
|
||||
zendata('product')->loadYaml('product', true, 4)->gen(10);
|
||||
zendata('project')->loadYaml('project_type', true, 4)->gen(100);
|
||||
zendata('story')->loadYaml('story_closeddate', true, 4)->gen(1000);
|
||||
zendata('projectstory')->loadYaml('executionstory', true, 4)->gen(1000);
|
||||
|
||||
|
||||
$metric = new metricTest();
|
||||
$calc = $metric->calcMetric(__FILE__);
|
||||
|
||||
r(count($calc->getResult())) && p('') && e('6'); // 测试分组数。
|
||||
|
||||
r($calc->getResult(array('project' => '4'))) && p('0:value') && e('10'); // 测试项目4。
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: zt_story
|
||||
author: qixinzhi
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: id
|
||||
range: 1-10000
|
||||
- field: product
|
||||
range: 1-10{70}
|
||||
- field: estimate
|
||||
range: 1-10{70}
|
||||
- field: openedDate
|
||||
range: "20100101 000000-20120101 230000:10D"
|
||||
type: timestamp
|
||||
format: YYYY-MM-DD hh:mm:ss
|
||||
- field: closedDate
|
||||
range: "20110101 000000-20120101 230000:10D"
|
||||
type: timestamp
|
||||
format: YYYY-MM-DD hh:mm:ss
|
||||
- field: closedReason
|
||||
range: bydesign{1},cancel{1},done{1},duplicate{1},postponed{1},subdivided{1},willnotdo{1},done{1}
|
||||
- field: status
|
||||
range: changing{7},active{7},draft{7},reviewing{7},closed{7}
|
||||
- field: type
|
||||
range: story
|
||||
- field: deleted
|
||||
range: 0{35},1{35}
|
||||
...
|
||||
Reference in New Issue
Block a user