progress_of_task_in_execution.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * 按执行统计的任务进度。
  4. * Progress of task in execution.
  5. *
  6. * 范围:execution
  7. * 对象:task
  8. * 目的:rate
  9. * 度量名称:按执行统计的任务进度
  10. * 单位:%
  11. * 描述:按执行统计的任务进度是指执行团队按已消耗的工时数与已消耗和剩余的工时数的比率。该度量项反映了任务的执行进展情况,可以帮助团队评估任务是否按计划进行并做出相应调整。
  12. * 定义:复用:;按执行统计的任务消耗工时数;按执行统计的任务剩余工时数;公式:;按执行统计的任务进度=按执行统计的任务消耗工时数/(按执行统计的任务消耗工时数+按执行统计的任务剩余工时数);
  13. *
  14. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  15. * @author zhouxin <zhouxin@easycorp.ltd>
  16. * @package
  17. * @uses func
  18. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  19. * @Link https://www.zentao.net
  20. */
  21. class progress_of_task_in_execution extends baseCalc
  22. {
  23. public $dataset = 'getExecutions';
  24. public $fieldList = array('t1.id', 't1.progress');
  25. public $result = array();
  26. public function calculate($row)
  27. {
  28. $execution = $row->id;
  29. $progress = $row->progress;
  30. $this->result[$execution] = (float)$progress / 100;
  31. }
  32. public function getResult($options = array())
  33. {
  34. $records = $this->getRecords(array('execution', 'value'));
  35. return $this->filterByOptions($records, $options);
  36. }
  37. }