*[task#124858,done,2h].

This commit is contained in:
songchenxuan
2024-08-07 16:28:50 +08:00
committed by 周鑫
parent 2314f600c5
commit 8f4fddad4b
3 changed files with 82 additions and 0 deletions
+14
View File
@@ -4396,3 +4396,17 @@ $config->bi->builtin->metrics[] = array
'desc' => '按代码库统计的的每日代码提交次数是指代码库每日的代码提交数量。这个度量项可以反映代码库每日开发活动频率和代码更新情况。',
'definition' => '代码库中代码提交次数求和,提交时间为某日。'
);
$config->bi->builtin->metrics[] = array
(
'name' => '按执行统计的新增有效Bug总数',
'alias' => '新增有效Bug总数',
'code' => 'count_of_effective_bug_in_execution',
'purpose' => 'scale',
'scope' => 'execution',
'object' => 'bug',
'unit' => 'count',
'dateType' => 'nodate',
'desc' => '按执行统计的新增有效Bug总数是指在执行中发现的有效Bug的数量。这个度量项反映了执行的质量情况。新增有效Bug数越多可能代表执行的代码质量存在的问题越多,需要进行进一步的解决和改进。',
'definition' => "执行中新增Bug个数求和\n解决方案为已解决,延期处理和不予解决或状态为激活\n过滤已删除的Bug\n过滤已删除的执行\n过滤已删除的项目\n过滤已删除的产品\n"
);
@@ -0,0 +1,43 @@
<?php
/**
* 按执行统计的新增有效Bug总数。
* Count of effective bug in execution.
*
* 范围:execution
* 对象:bug
* 目的:scale
* 度量名称:按执行统计的新增有效Bug总数
* 单位:个
* 描述:按执行统计的新增有效Bug总数是指在执行中发现的有效Bug的数量。这个度量项反映了执行的质量情况。新增有效Bug数越多可能代表执行的代码质量存在的问题越多,需要进行进一步的解决和改进。
* 定义:执行中新增Bug个数求和;解决方案为已解决、延期处理和不予解决或状态为激活;过滤已删除的Bug;过滤已删除的执行;过滤已删除的项目;过滤已删除的产品。
*
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @author zhouxin <zhouxin@easycorp.ltd>
* @package
* @uses func
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @Link https://www.zentao.net
*/
class count_of_effective_bug_in_execution extends baseCalc
{
public $dataset = 'getExecutionBugs';
public $fieldList = array('t1.execution', 't1.status', 't1.resolution');
public $result = array();
public function calculate($row)
{
if($row->status == 'active' || in_array($row->resolution, array('fixed', 'postponed', 'willnotfix')))
{
if(!isset($this->result[$row->execution])) $this->result[$row->execution] = 0;
$this->result[$row->execution] ++;
}
}
public function getResult($options = array())
{
$records = $this->getRecords(array('execution', 'value'));
return $this->filterByOptions($records, $options);
}
}
+25
View File
@@ -223,6 +223,31 @@ class dataset
return $this->defaultWhere($stmt, 't2');
}
/**
* 获取执行bug数据。
* Get execution product bug list.
*
* @param string $fieldList
* @access public
* @return PDOStatement
*/
public function getExecutionBugs($fieldList)
{
$stmt = $this->dao->select($fieldList)
->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.execution=t3.id')
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project=t4.id')
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->andWhere('t2.shadow')->eq(0)
->andWhere('t3.deleted')->eq(0)
->andWhere('t3.type')->in('sprint,stage,kanban')
->andWhere('t4.deleted')->eq(0);
return $this->defaultWhere($stmt, 't2');
}
/**
* 获取所有bug数据。
* Get all bug list.