From 43395f33585acad93e176fbb91a6742a54eb8ee8 Mon Sep 17 00:00:00 2001 From: qixinzhi Date: Wed, 19 Jul 2023 06:25:56 +0000 Subject: [PATCH] * Finish task#97961. --- .../calc/global/scale/count_of_story.php | 14 +++++----- .../test/calc/global/scale/count_of_story.php | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 module/metric/test/calc/global/scale/count_of_story.php diff --git a/module/metric/calc/global/scale/count_of_story.php b/module/metric/calc/global/scale/count_of_story.php index 1cecfd727d..7a1c68f3ce 100644 --- a/module/metric/calc/global/scale/count_of_story.php +++ b/module/metric/calc/global/scale/count_of_story.php @@ -10,7 +10,7 @@ * 单位:个 * 描述:按全局统计的研发需求总数表示组织中的研发需求的总数。该度量项反映了组织中所有研发需求的数量,可以用于评估组织的研发活动和需求管理能力。 * 定义:所有的研发需求个数求和 -过滤已删除的研发需求 + * 过滤已删除的研发需求 * 度量库: * 收集方式:realtime * @@ -23,20 +23,20 @@ */ class count_of_story extends baseCalc { - public $dataset = null; + public $dataset = 'getDevStories'; - public $fieldList = array(); + public $fieldList = array('t1.id'); - //public funtion getStatement($dao) - //{ - //} + public $result = 0; public function calculate($data) { + $this->result += 1; } public function getResult($options = array()) { + $records = array(array('value' => $this->result)); return $this->filterByOptions($this->result, $options); } -} \ No newline at end of file +} diff --git a/module/metric/test/calc/global/scale/count_of_story.php b/module/metric/test/calc/global/scale/count_of_story.php new file mode 100755 index 0000000000..0fd1662ade --- /dev/null +++ b/module/metric/test/calc/global/scale/count_of_story.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +config('product', $useCommon = true, $levels = 4)->gen(10); +zdTable('story')->config('story_stage', $useCommon = true, $levels = 4)->gen(839, true, false); +$calc = $metric->calcMetric(__FILE__); +r($calc->getResult()) && p('0:value') && e('210'); // 测试839条数据全局研发需求数。 + +zdTable('story')->config('story_stage', $useCommon = true, $levels = 4)->gen(500, true, false); +$calc = $metric->calcMetric(__FILE__); +r($calc->getResult()) && p('0:value') && e('130'); // 测试500条数据全局研发需求数。 + +zdTable('story')->config('story_stage', $useCommon = true, $levels = 4)->gen(1252, true, false); +$calc = $metric->calcMetric(__FILE__); +r($calc->getResult()) && p('0:value') && e('320'); // 测试1252条数据全局研发需求数。