count_of_task_in_execution.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * 按执行统计的任务总数。
  4. * Count of task in execution.
  5. *
  6. * 范围:execution
  7. * 对象:task
  8. * 目的:scale
  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 count_of_task_in_execution extends baseCalc
  22. {
  23. public $dataset = 'getTasks';
  24. public $fieldList = array('t1.execution');
  25. public $result = array();
  26. public function calculate($row)
  27. {
  28. if(!isset($this->result[$row->execution])) $this->result[$row->execution] = 0;
  29. $this->result[$row->execution] ++;
  30. }
  31. public function getResult($options = array())
  32. {
  33. $records = $this->getRecords(array('execution', 'value'));
  34. return $this->filterByOptions($records, $options);
  35. }
  36. }