* Finish task#98449.

This commit is contained in:
qixinzhi
2023-07-25 07:31:46 +00:00
parent becf9b7d36
commit a632797a70
2 changed files with 37 additions and 9 deletions
@@ -10,9 +10,9 @@
* 单位:个
* 描述:按全局统计的激活Bug数是指当前尚未解决的Bug数量。这个度量项反映了系统或项目当前存在的待解决问题数量。激活Bug总数越多可能代表系统或项目的稳定性较低,需要加强Bug解决的速度和质量。
* 定义:所有Bug个数求和
状态为激活
过滤已删除的Bug
过滤已删除的产品
* 状态为激活
* 过滤已删除的Bug
* 过滤已删除的产品
* 度量库:
* 收集方式:realtime
*
@@ -25,16 +25,15 @@
*/
class count_of_activated_bug extends baseCalc
{
public $dataset = null;
public $dataset = 'getBugs';
public $fieldList = array();
public $fieldList = array('t1.status');
//public funtion getStatement($dao)
//{
//}
public $result = 0;
public function calculate($row)
{
if($row->status == 'active') $this->result += 1;
}
public function getResult($options = array())
@@ -42,4 +41,4 @@ class count_of_activated_bug extends baseCalc
$records = $this->getRecords(array('value'));
return $this->filterByOptions($records, $options);
}
}
}
@@ -0,0 +1,29 @@
#!/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);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=count_of_activated_bug
cid=1
pid=1
*/
zdTable('bug')->config('bug_resolution_status', $useCommon = true, $levels = 4)->gen(356, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('32'); // 测试356条数据Bug数。
zdTable('bug')->config('bug_resolution_status', $useCommon = true, $levels = 4)->gen(652, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('56'); // 测试652条数据Bug数。
zdTable('bug')->config('bug_resolution_status', $useCommon = true, $levels = 4)->gen(1265, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('110'); // 测试1265条数据Bug数。