* Add metrics:count_of_story_in_product,count_of_valid_story_in_product

This commit is contained in:
zhouxin
2023-07-18 10:27:52 +08:00
parent 5e11d9a514
commit 26d841ab4a
3 changed files with 37 additions and 33 deletions
@@ -29,7 +29,7 @@ class count_of_invalid_story_in_product extends baseCalc
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->andWhere('t1.status')->eq('closed')
->andWhere('t1.type')->eq('story')
->andWhere('t1.closedReason')->in('duplicate,willnotdo,bydesign,cancel')
->groupBy('t1.product')
->query();
@@ -1,21 +1,19 @@
<?php
/**
* 按产品统计的研发需求总数。
* .
* count_of_story_in_product
*
* 范围:product
* 对象:story
* 目的:scale
* 度量名称:按产品统计的研发需求总数
* 单位:个
* 描述:产品中研发需求的个数求和
过滤已删除的研发需求
过滤已删除的产品
* 描述:产品中研发需求的个数求和 过滤已删除的研发需求 过滤已删除的产品
* 度量库:
* 收集方式: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)
@@ -23,21 +21,20 @@
*/
class count_of_story_in_product extends baseCalc
{
public $dataset = '';
public $dataset = 'getDevStories';
public $fieldList = array();
public $fieldList = array('t1.product');
public $result = array();
public function calculate($row)
{
if(!isset($this->result[$row->product])) $this->result[$row->product] = 0;
$this->result[$row->product] ++;
}
//public function getStatement()
//{
//}
//public function calculate($data)
//{
//}
//public function getResult()
//{
//}
}
public function getResult($options = array())
{
$records = array();
foreach($this->result as $product => $value) $records[] = array('product' => $product, 'value' => $value);
return $this->filterByOptions($records, $options);
}
}
@@ -13,7 +13,7 @@
* 收集方式: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)
@@ -21,20 +21,27 @@
*/
class count_of_valid_story_in_product extends baseCalc
{
public $dataset = null;
public $fieldList = array();
//public funtion getStatement($dao)
//{
//}
public function calculate($data)
public function getStatement()
{
return $this->dao->select('t1.product,t1.id')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->andWhere('t1.type')->eq('story')
->andWhere('t1.closedReason')->notin('duplicate,willnotdo,bydesign,cancel')
->query();
}
public function calculate($row)
{
if(!isset($this->result[$row->product])) $this->result[$row->product] = 0;
$this->result[$row->product] += 1;
}
public function getResult($options = array())
{
return $this->filterByOptions($this->result, $options);
$records = array();
foreach($this->result as $product => $value) $records[] = array('product' => $product, 'value' => $value);
return $this->filterByOptions($records, $options);
}
}
}