* measurement: finish task #98011,98011.add metrics.

This commit is contained in:
zhouxin
2023-07-20 16:36:48 +08:00
parent ef376ffec8
commit 86e78e3fc5
5 changed files with 57 additions and 27 deletions
@@ -10,13 +10,13 @@
* 单位:个
* 描述:按全局统计的年度关闭项目数是指在某月度关闭的项目数量。这个度量项可以帮助团队了解某年度项目的执行情况和成果,并进行项目交付能力的评估。较高的年度关闭项目数表明团队在项目交付方面具有较高的效率。
* 定义:所有的项目个数求和
关闭时间为某年某月
过滤已删除的项目
* 关闭时间为某年某月
* 过滤已删除的项目
* 度量库:
* 收集方式:realtime
*
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @author qixinzhi <qixinzhi@easycorp.ltd>
* @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)
@@ -24,20 +24,35 @@
*/
class count_of_monthly_closed_project extends baseCalc
{
public $dataset = null;
public $dataset = 'getAllProjects';
public $fieldList = array();
public $fieldList = array('status', 'closedDate');
//public funtion getStatement($dao)
//{
//}
public function calculate($data)
public function calculate($row)
{
if(empty($row->closedDate) || $row->status != 'closed') return;
$year = substr($row->closedDate, 0, 4);
$month = substr($row->closedDate, 5, 2);
if($year == '0000') return;
if(!isset($this->result[$year])) $this->result[$year] = array();
if(!isset($this->result[$year][$month])) $this->result[$year][$month] = 0;
$this->result[$year][$month] += 1;
}
public function getResult($options = array())
{
return $this->filterByOptions($this->result, $options);
$records = array();
foreach($this->result as $year => $months)
{
foreach($months as $month => $value)
{
$records[] = array('year' => $year, 'month' => $month, 'value' => $value);
}
}
return $this->filterByOptions($records, $options);
}
}
}
@@ -10,13 +10,13 @@
* 单位:个
* 描述:按全局统计的月度新增项目数是指在某月度新启动的项目数量。这个度量项可以帮助团队了解某年度项目规模和工作负荷,以及项目管理和资源分配的需求。较高的年度新增项目数可能需要团队根据资源和能力进行优先级和规划管理。
* 定义:所有的项目个数求和
创建时间为某年某月
过滤已删除的项目
* 创建时间为某年某月
* 过滤已删除的项目
* 度量库:
* 收集方式:realtime
*
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @author qixinzhi <qixinzhi@easycorp.ltd>
* @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)
@@ -24,20 +24,35 @@
*/
class count_of_monthly_created_project extends baseCalc
{
public $dataset = null;
public $dataset = 'getAllProjects';
public $fieldList = array();
public $fieldList = array('openedDate');
//public funtion getStatement($dao)
//{
//}
public function calculate($data)
public function calculate($row)
{
if(empty($row->openedDate)) return;
$year = substr($row->openedDate, 0, 4);
$month = substr($row->openedDate, 5, 2);
if($year == '0000') return;
if(!isset($this->result[$year])) $this->result[$year] = array();
if(!isset($this->result[$year][$month])) $this->result[$year][$month] = 0;
$this->result[$year][$month] += 1;
}
public function getResult($options = array())
{
return $this->filterByOptions($this->result, $options);
$records = array();
foreach($this->result as $year => $months)
{
foreach($months as $month => $value)
{
$records[] = array('year' => $year, 'month' => $month, 'value' => $value);
}
}
return $this->filterByOptions($records, $options);
}
}
}
@@ -32,7 +32,7 @@ class count_of_daily_closed_bug_in_product extends baseCalc
$date = substr($row->closedDate, 0, 10);
list($year, $month, $day) = explode('-', $date);
if($year == '0000' || $month == '00' || $day == '00') return;
if($year == '0000') return;
if(!isset($this->result[$row->product])) $this->result[$row->product] = array();
if(!isset($this->result[$row->product][$year])) $this->result[$row->product][$year] = array();
@@ -32,7 +32,7 @@ class count_of_daily_created_bug_in_product extends baseCalc
$date = substr($row->openedDate, 0, 10);
list($year, $month, $day) = explode('-', $date);
if($year == '0000' && $month == '00' && $day == '00') return;
if($year == '0000') return;
if(!isset($this->result[$row->product])) $this->result[$row->product] = array();
if(!isset($this->result[$row->product][$year])) $this->result[$row->product][$year] = array();
@@ -32,7 +32,7 @@ class count_of_daily_resolved_bug_in_product extends baseCalc
$date = substr($row->resolvedDate, 0, 10);
list($year, $month, $day) = explode('-', $date);
if($year == '0000' && $month == '00' && $day == '00') return;
if($year == '0000') return;
if(!isset($this->result[$row->product])) $this->result[$row->product] = array();
if(!isset($this->result[$row->product][$year])) $this->result[$row->product][$year] = array();