* Finish task#99201.

This commit is contained in:
qixinzhi
2023-08-02 08:03:10 +00:00
parent 9b416fd425
commit 552d545403
7 changed files with 51 additions and 9 deletions
@@ -1,7 +1,7 @@
<?php
/**
* 按瀑布项目统计的已完成任务工作的预计工时(EV)。
* ev_of_finished_task_in_waterfall.
* Ev of finished task in waterfall.
*
* 范围:project
* 对象:task
@@ -9,7 +9,7 @@
* 度量名称:按瀑布项目统计的已完成任务工作的预计工时(EV)
* 单位:h
* 描述:按瀑布项目统计的已完成任务工作的预计工时指的是在瀑布项目管理方法中,已经完成的任务的预计工时。这个度量项用来评估项目进展与实际完成情况的一致性。EV的值越高,代表项目团队在按计划完成任务的工作量方面表现得越好。
* 定义:复用:;按项目统计的任务进度;按项目统计的任务预计工时数;公式:;按项目统计的已完成任务工作的预计工时(EV)=按项目统计的任务预计工时数*按项目统计的任务进度;要求项目为瀑布项目;过滤已删除的任务;过滤已取消的任务;过滤已删除执行下的任务;过滤已删除的项目
* 定义:复用:;按项目统计的任务进度;按项目统计的任务预计工时数;公式:;按项目统计的已完成任务工作的预计工时(EV)=按项目统计的任务预计工时数*按项目统计的任务进度;要求项目为瀑布项目;过滤已删除的任务;过滤已取消的任务;过滤已删除执行下的任务;过滤已删除的项目;
* 度量库:
* 收集方式:realtime
*
@@ -22,21 +22,40 @@
*/
class ev_of_finished_task_in_waterfall extends baseCalc
{
public $dataset = null;
public $result = array();
public $fieldList = array();
public function getStatement()
{
$ev = $this->dao->select('project, SUM(estimate) as estimate')
->from(TABLE_TASK)
->where('deleted')->eq('0')
->andWhere('parent')->ne('-1')
->andWhere('status', true)->in('done,closed')
->orWhere('closedReason')->eq('done')
->markRight(1)
->groupBy('project')
->get();
//public funtion getStatement($dao)
//{
//}
return $this->dao->select('t1.id as project, t2.estimate as ev')
->from(TABLE_PROJECT)->alias('t1')
->leftJoin("($ev)")->alias('t2')->on('t1.id=t2.project')
->where('t1.deleted')->eq('0')
->andWhere('t1.type')->eq('project')
->andWhere('t1.model')->eq('waterfall')
->query();
}
public function calculate($row)
{
$project = $row->project;
$ev = $row->ev;
if(!isset($this->result[$project])) $this->result[$project] = $ev;
}
public function getResult($options = array())
{
$records = $this->getRecords(array('value'));
$records = $this->getRecords(array('project', 'value'));
return $this->filterByOptions($records, $options);
}
}
}
View File
View File
View File
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 7) . '/test/lib/init.php';
include dirname(__FILE__, 4) . '/calc.class.php';
zdTable('project')->config('waterfall', $useCommon = true, $levels = 4)->gen(10);
zdTable('project')->config('stage', $useCommon = true, $levels = 4)->gen(40, false);
zdTable('task')->config('task_waterfall', $useCommon = true, $levels = 4)->gen(1000);
$metric = new metricTest();
$calc = $metric->calcMetric(__FILE__);
/**
title=ev_of_finished_task_in_waterfall
cid=1
pid=1
*/
r(count($calc->getResult())) && p('') && e('5'); // 测试分组数。
r($calc->getResult(array('project' => '7'))) && p('0:value') && e('59'); // 测试项目7。