* Finish task#97961.

This commit is contained in:
qixinzhi
2023-07-19 06:26:19 +00:00
parent 19fe118548
commit 43395f3358
2 changed files with 34 additions and 7 deletions
@@ -10,7 +10,7 @@
* 单位:个
* 描述:按全局统计的研发需求总数表示组织中的研发需求的总数。该度量项反映了组织中所有研发需求的数量,可以用于评估组织的研发活动和需求管理能力。
* 定义:所有的研发需求个数求和
过滤已删除的研发需求
* 过滤已删除的研发需求
* 度量库:
* 收集方式:realtime
*
@@ -23,20 +23,20 @@
*/
class count_of_story extends baseCalc
{
public $dataset = null;
public $dataset = 'getDevStories';
public $fieldList = array();
public $fieldList = array('t1.id');
//public funtion getStatement($dao)
//{
//}
public $result = 0;
public function calculate($data)
{
$this->result += 1;
}
public function getResult($options = array())
{
$records = array(array('value' => $this->result));
return $this->filterByOptions($this->result, $options);
}
}
}
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
$metric = new metricTest();
/**
title=count_of_story
timeout=0
cid=1
*/
zdTable('product')->config('product', $useCommon = true, $levels = 4)->gen(10);
zdTable('story')->config('story_stage', $useCommon = true, $levels = 4)->gen(839, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('210'); // 测试839条数据全局研发需求数。
zdTable('story')->config('story_stage', $useCommon = true, $levels = 4)->gen(500, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('130'); // 测试500条数据全局研发需求数。
zdTable('story')->config('story_stage', $useCommon = true, $levels = 4)->gen(1252, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('320'); // 测试1252条数据全局研发需求数。