* Finish task #99190.

This commit is contained in:
zhouxin
2023-08-01 16:45:46 +08:00
parent 14657ec685
commit c3e51e9cfb
2 changed files with 32 additions and 9 deletions
@@ -14,7 +14,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)
@@ -22,21 +22,25 @@
*/
class left_period_of_project extends baseCalc
{
public $dataset = null;
public $dataset = 'getAllProjects';
public $fieldList = array();
//public funtion getStatement($dao)
//{
//}
public $fieldList = array('id', 'status', 'end');
public function calculate($row)
{
if($row->status == 'closed')
{
$this->result[$row->id] = 0;
}
else
{
$this->result[$row->id] = $row->end - date('Y-m-d');
}
}
public function getResult($options = array())
{
$records = $this->getRecords(array('value'));
$records = $this->getRecords(array('project', 'value'));
return $this->filterByOptions($records, $options);
}
}
}
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('project')->config('project_status', $useCommon = true, $levels = 4)->gen(100);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=left_period_of_project
cid=1
pid=1
*/
r(count($calc->getResult())) && p('') && e('100'); // 测试分组数。