* Finish task#99222.

This commit is contained in:
qixinzhi
2023-08-01 08:01:11 +00:00
parent 0ceb80955d
commit 47678dd1f2
2 changed files with 34 additions and 9 deletions
@@ -1,7 +1,7 @@
<?php
/**
* 按执行统计的有效研发需求数。
* count_of_valid_story_in_execution.
* Count of valid story in execution.
*
* 范围:execution
* 对象:story
@@ -9,7 +9,7 @@
* 度量名称:按执行统计的有效研发需求数
* 单位:个
* 描述:按执行统计的有效研发需求数是指被确认为有效的研发需求数量。有效需求指的是符合项目策略和目标,可以实施并且对用户有价值的需求。通过对有效需求的统计,可以帮助执行团队评估项目需求的质量和重要性,并进行优先级排序和资源分配。较高的有效需求数量通常表示执行的功能和特性满足了用户和市场的期望,有利于实现项目的成功交付和用户满意度。
* 定义:复用:;按执行统计的无效研发需求数;按执行统计的研发需求总数;公式:;按执行统计的有效研发需求数=按执行统计的研发需求总数-按执行统计的无效研发需求数
* 定义:复用:;按执行统计的无效研发需求数;按执行统计的研发需求总数;公式:;按执行统计的有效研发需求数=按执行统计的研发需求总数-按执行统计的无效研发需求数;
* 度量库:
* 收集方式:realtime
*
@@ -22,21 +22,22 @@
*/
class count_of_valid_story_in_execution extends baseCalc
{
public $dataset = null;
public $dataset = 'getDevStoriesWithExecution';
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','bydesign'))) $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);
}
}
}
@@ -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_type', $useCommon = true, $levels = 4)->gen(100);
zdTable('story')->config('story_status_closedreason', $useCommon = true, $levels = 4)->gen(1000);
zdTable('projectstory')->config('executionstory', $useCommon = true, $levels = 4)->gen(1000);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=count_of_valid_story_in_execution
cid=1
pid=1
*/
r(count($calc->getResult())) && p('') && e('10'); // 测试分组数。
r($calc->getResult(array('project' => '4'))) && p('0:value') && e('3'); // 测试项目4。