* Finish task#99207.
This commit is contained in:
+15
-9
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* 按项目统计的激活Bug数。
|
||||
* count_of_activated_bug_in_project.
|
||||
* Count of activated bug in project.
|
||||
*
|
||||
* 范围:project
|
||||
* 对象:bug
|
||||
@@ -9,7 +9,7 @@
|
||||
* 度量名称:按项目统计的激活Bug数
|
||||
* 单位:个
|
||||
* 描述:按项目统计的激活Bug数是指当前未解决的Bug数量。这个度量项反映了项目当前存在的待解决问题数量。激活Bug总数越多可能代表项目的稳定性较低,需要加强Bug解决的速度和质量。
|
||||
* 定义:项目中Bug个数求和;状态为激活;过滤已删除的Bug;过滤已删除的项目
|
||||
* 定义:项目中Bug个数求和;状态为激活;过滤已删除的Bug;过滤已删除的项目;
|
||||
* 度量库:
|
||||
* 收集方式:realtime
|
||||
*
|
||||
@@ -22,21 +22,27 @@
|
||||
*/
|
||||
class count_of_activated_bug_in_project extends baseCalc
|
||||
{
|
||||
public $dataset = null;
|
||||
public $dataset = 'getProjectBugs';
|
||||
|
||||
public $fieldList = array();
|
||||
public $fieldList = array('t1.status', 't1.project');
|
||||
|
||||
//public funtion getStatement($dao)
|
||||
//{
|
||||
//}
|
||||
public $result = array();
|
||||
|
||||
public function calculate($row)
|
||||
{
|
||||
$project = $row->project;
|
||||
$status = $row->status;
|
||||
|
||||
if(!isset($this->result[$project])) $this->result[$project] = 0;
|
||||
|
||||
if($status == 'active') $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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Regular → Executable
Regular → Executable
+24
@@ -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('bug')->config('bug_resolution_status', $useCommon = true, $levels = 4)->gen(1000);
|
||||
|
||||
$metric = new metricTest();
|
||||
$calc = $metric->calcMetric(__FILE__);
|
||||
|
||||
/**
|
||||
|
||||
title=count_of_activated_bug_in_project
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
|
||||
r(count($calc->getResult())) && p('') && e('3'); // 测试分组数。
|
||||
|
||||
|
||||
r($calc->getResult(array('porject' => 1))) && p('0:value') && e('24'); // 测试项目1。
|
||||
Regular → Executable
Regular → Executable
@@ -7,6 +7,8 @@ fields:
|
||||
range: 1-10000
|
||||
- field: product
|
||||
range: 1-10{48}
|
||||
- field: project
|
||||
range: 1-10{48}
|
||||
- field: openedDate
|
||||
range: "20100101 000000-20210101 230000:10D"
|
||||
type: timestamp
|
||||
|
||||
Reference in New Issue
Block a user