* Add metrics.

This commit is contained in:
zhouxin
2023-07-13 17:31:50 +08:00
parent 2b6ceb3ebe
commit 7cf4788cd0
2 changed files with 37 additions and 31 deletions
@@ -8,14 +8,12 @@
* 目的: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,25 @@
*/
class count_of_closed_story_in_product extends baseCalc
{
public $dataset = '';
public $dataset = 'getDevStories';
public $fieldList = array();
public $fieldList = array('t1.product', 't1.stage');
public $result = array();
//public function getStatement()
//{
//}
public function calculate($row)
{
if($row->stage == 'closed')
{
if(!isset($this->result[$row->product])) $this->result[$row->product] = 0;
$this->result[$row->product] ++;
}
}
//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);
}
}
@@ -16,7 +16,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)
@@ -24,21 +24,25 @@
*/
class count_of_unclosed_story_in_product extends baseCalc
{
public $dataset = '';
public $dataset = 'getDevStories';
public $fieldList = array();
public $fieldList = array('t1.product', 't1.stage');
public $result = array();
//public function getStatement()
//{
//}
public function calculate($row)
{
if($row->stage != 'closed')
{
if(!isset($this->result[$row->product])) $this->result[$row->product] = 0;
$this->result[$row->product] ++;
}
}
//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);
}
}