* Finish task#98376.

This commit is contained in:
qixinzhi
2023-07-25 05:29:33 +00:00
parent 2bd2823048
commit 48202372b2
2 changed files with 38 additions and 10 deletions
@@ -10,10 +10,10 @@
* 单位:个
* 描述:按全局统计的未关闭执行数表示在整个系统中未关闭的执行项的数量,可以用来了解未关闭的执行数量。
* 定义:复用:
按全局统计的执行总数
按全局统计的已关闭执行数
公式:
按全局统计的未关闭执行数=安全局统计的执行总数-按全局统计的已关闭执行数
* 按全局统计的执行总数
* 按全局统计的已关闭执行数
* 公式:
* 按全局统计的未关闭执行数=安全局统计的执行总数-按全局统计的已关闭执行数
* 度量库:
* 收集方式:realtime
*
@@ -26,16 +26,15 @@
*/
class count_of_unclosed_execution extends baseCalc
{
public $dataset = null;
public $dataset = 'getALlExecutions';
public $fieldList = array();
public $fieldList = array('status');
//public funtion getStatement($dao)
//{
//}
public $result = 0;
public function calculate($row)
{
if($row->status != 'closed') $this->result += 1;
}
public function getResult($options = array())
@@ -43,4 +42,4 @@ class count_of_unclosed_execution extends baseCalc
$records = $this->getRecords(array('value'));
return $this->filterByOptions($records, $options);
}
}
}
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('product')->config('product', $useCommon = true, $levels = 4)->gen(10);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=count_of_unclosed_execution
cid=1
pid=1
*/
zdTable('project')->config('project_type', $useCommon = true, $levels = 4)->gen(356, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('72'); // 测试356条数据。
zdTable('project')->config('project_type', $useCommon = true, $levels = 4)->gen(652, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('126'); // 测试652条数据。
zdTable('project')->config('project_type', $useCommon = true, $levels = 4)->gen(1265, true, false);
$calc = $metric->calcMetric(__FILE__);
r($calc->getResult()) && p('0:value') && e('234'); // 测试1265条数据。