* Finish task#97964.
This commit is contained in:
@@ -10,9 +10,9 @@
|
||||
* 单位:个
|
||||
* 描述:按全局统计的未关闭研发需求数表示尚未完成的研发需求的数量。该度量项反映了组织中尚未完成并关闭的研发需求的数量,可以用于评估组织的研发需求执行进展和挑战。
|
||||
* 定义:复用:
|
||||
按全局统计的研发需求总数
|
||||
按全局统计的已关闭研发需求数
|
||||
公式:按全局统计的未关闭研发需求数=按全局统计的研发需求总数-按全局统计的已关闭研发需求数
|
||||
* 按全局统计的研发需求总数
|
||||
* 按全局统计的已关闭研发需求数
|
||||
* 公式:按全局统计的未关闭研发需求数=按全局统计的研发需求总数-按全局统计的已关闭研发需求数
|
||||
* 度量库:
|
||||
* 收集方式:realtime
|
||||
*
|
||||
@@ -25,20 +25,21 @@
|
||||
*/
|
||||
class count_of_unclosed_story extends baseCalc
|
||||
{
|
||||
public $dataset = null;
|
||||
public $dataset = 'getDevStories';
|
||||
|
||||
public $fieldList = array();
|
||||
public $fieldList = array('t1.stage');
|
||||
|
||||
//public funtion getStatement($dao)
|
||||
//{
|
||||
//}
|
||||
public $result = 0;
|
||||
|
||||
public function calculate($data)
|
||||
{
|
||||
$stage = $data->stage;
|
||||
if($stage != 'closed') $this->result ++;
|
||||
}
|
||||
|
||||
public function getResult($options = array())
|
||||
{
|
||||
$records = array(array('value' => $this->result));
|
||||
return $this->filterByOptions($this->result, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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_unclosed_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('189'); // 测试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('117'); // 测试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('288'); // 测试1252条数据全局未关闭研发需求数。
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: zt_story
|
||||
author: qixinzhi
|
||||
version: "1.0"
|
||||
fields:
|
||||
- field: id
|
||||
range: 1-10000
|
||||
- field: product
|
||||
range: 1-10{20}
|
||||
- field: openedDate
|
||||
range: "20100101 000000-20210101 230000:10D"
|
||||
type: timestamp
|
||||
format: YYYY-MM-DD hh:mm:ss
|
||||
- field: closedDate
|
||||
range: "20110101 000000-20210101 230000:10D"
|
||||
type: timestamp
|
||||
format: YYYY-MM-DD hh:mm:ss
|
||||
- field: estimate
|
||||
range: 1-10{10}
|
||||
- field: stage
|
||||
range: wait{1},planned{1},projected{1},developing{1},developed{1},testing{1},tested{1},verified{1},released{1},closed{1}
|
||||
- field: type
|
||||
range: story
|
||||
- field: deleted
|
||||
range: 0{10},1{10}
|
||||
...
|
||||
Reference in New Issue
Block a user