* Finish story#47876.
This commit is contained in:
+12
-11
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* 按项目统计的已关闭Bug数。
|
||||
* count_of_closed_bug_in_project.
|
||||
* Count of closed bug in project.
|
||||
*
|
||||
* 范围:project
|
||||
* 对象:bug
|
||||
* 目的:scale
|
||||
* 度量名称:按项目统计的已关闭Bug数
|
||||
* 单位:个
|
||||
* 描述:按项目统计的已关闭Bug总数是指已经被关闭的Bug数量。这个度量项反映了项目中已经关闭的缺陷数量。已关闭Bug总数的增加说明项目进行了持续的改进和修复工作。
|
||||
* 定义:项目中Bug个数求和;状态为已关闭;过滤已删除的Bug;过滤已删除的项目
|
||||
* 描述:按项目统计的已关闭Bug总数是指已经被关闭的Bug数量。这个度量项反映了项目中已经关闭的缺陷数量。已关闭Bug总数的增加说明项目进行了持续的改进和修复工作。
|
||||
* 定义:项目中Bug个数求和;状态为已关闭;过滤已删除的Bug;过滤已删除的项目;
|
||||
* 度量库:
|
||||
* 收集方式:realtime
|
||||
*
|
||||
@@ -22,21 +22,22 @@
|
||||
*/
|
||||
class count_of_closed_bug_in_project extends baseCalc
|
||||
{
|
||||
public $dataset = null;
|
||||
public $dataset = 'getProjectBugs';
|
||||
|
||||
public $fieldList = array();
|
||||
|
||||
//public funtion getStatement($dao)
|
||||
//{
|
||||
//}
|
||||
public $fieldList = array('t1.project', 't1.status');
|
||||
|
||||
public function calculate($row)
|
||||
{
|
||||
$project = $row->project;
|
||||
$status = $row->status;
|
||||
|
||||
if(!isset($this->result[$project])) $this->result[$project] = 0;
|
||||
if($status == 'closed') $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_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_closed_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。
|
||||
Reference in New Issue
Block a user