* Finish task#99185.

This commit is contained in:
qixinzhi
2023-08-01 06:03:20 +00:00
parent 3bcc022958
commit 9fe6c4b5fe
7 changed files with 35 additions and 10 deletions
@@ -35,7 +35,7 @@ class count_of_invalid_story extends baseCalc
->andWhere('t2.deleted')->eq(0)
->andWhere('t1.type')->eq('story')
->andWhere('t2.shadow')->eq(0)
->andWhere('t1.closedReason')->in('duplicate,willnotdo,bydesign,cancel')
->andWhere('t1.closedReason')->in('duplicate,willnotdo,bydesign')
->query();
}
@@ -1,7 +1,7 @@
<?php
/**
* 按项目统计的无效研发需求数。
* count_of_invalid_story_in_project.
* Count of invalid story in project.
*
* 范围:project
* 对象:story
@@ -9,7 +9,7 @@
* 度量名称:按项目统计的无效研发需求数
* 单位:个
* 描述:按项目统计的无效研发需求数是指被判定为无效的研发需求数量。无效需求可能包括重复需求、不可实现的需求、或者与项目策略和目标不符的需求。通过对无效需求的统计,可以帮助项目团队优化需求管理和筛选机制,以提高需求有效性和资源利用率。较高的无效需求数量可能需要对需求收集和评估流程进行改进。
* 定义:项目中研发需求的个数求和;关闭原因为重复、不做、设计如此;过滤已删除的研发需求;过滤已删除的项目
* 定义:项目中研发需求的个数求和;关闭原因为重复、不做、设计如此;过滤已删除的研发需求;过滤已删除的项目;
* 度量库:
* 收集方式:realtime
*
@@ -22,21 +22,22 @@
*/
class count_of_invalid_story_in_project extends baseCalc
{
public $dataset = null;
public $dataset = 'getDevStoriesWithProject';
public $fieldList = array();
public $fieldList = array('t3.project', 't1.closedReason');
//public funtion getStatement($dao)
//{
//}
public $result = array();
public function calculate($row)
{
$project = $row->project;
if(!isset($this->result[$project])) $this->result[$project] = 0;
if(in_array($row->closedReason, array('duplicate','willnotdo','budesign'))) $this->result[$project] += 1;
}
public function getResult($options = array())
{
$records = $this->getRecords(array('value'));
$records = $this->getRecords(array('project', 'value'));
return $this->filterByOptions($records, $options);
}
}
}
View File
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('product')->config('product', $useCommon = true, $levels = 4)->gen(10);
zdTable('project')->config('project_close', $useCommon = true, $levels = 4)->gen(10);
zdTable('story')->config('story_status_closedreason', $useCommon = true, $levels = 4)->gen(1000);
zdTable('projectstory')->config('projectstory', $useCommon = true, $levels = 4)->gen(1000);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=count_of_invalid_story_in_project
cid=1
pid=1
*/
r(count($calc->getResult())) && p('') && e('6'); // 测试分组数。
r($calc->getResult(array('project' => '4'))) && p('0:value') && e('7'); // 测试。