diff --git a/module/metric/calc/product/scale/count_of_closed_story_in_product.php b/module/metric/calc/product/scale/count_of_closed_story_in_product.php index 02be2c7c9d..9d20cd3291 100644 --- a/module/metric/calc/product/scale/count_of_closed_story_in_product.php +++ b/module/metric/calc/product/scale/count_of_closed_story_in_product.php @@ -8,14 +8,12 @@ * 目的:scale * 度量名称:按产品统计的已关闭研发需求数 * 单位:个 - * 描述:产品中阶段为已关闭研发需求的个数求和 -过滤已删除的研发需求 -过滤已删除的产品 + * 描述:产品中阶段为已关闭研发需求的个数求和 过滤已删除的研发需求 过滤已删除的产品 * 度量库: * 收集方式:realtime * * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net) - * @author qixinzhi + * @author zhouxin * @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() - //{ - //} -} \ No newline at end of file + public function getResult($options = array()) + { + $records = array(); + foreach($this->result as $product => $value) $records[] = array('product' => $product, 'value' => $value); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/calc/product/scale/count_of_unclosed_story_in_product.php b/module/metric/calc/product/scale/count_of_unclosed_story_in_product.php index 8a55a2fc65..f1e08e34e2 100644 --- a/module/metric/calc/product/scale/count_of_unclosed_story_in_product.php +++ b/module/metric/calc/product/scale/count_of_unclosed_story_in_product.php @@ -16,7 +16,7 @@ * 收集方式:realtime * * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net) - * @author qixinzhi + * @author zhouxin * @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() - //{ - //} -} \ No newline at end of file + public function getResult($options = array()) + { + $records = array(); + foreach($this->result as $product => $value) $records[] = array('product' => $product, 'value' => $value); + return $this->filterByOptions($records, $options); + } +}