count_wait_execution_in_project.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * 按项目统计的未开始执行数。
  4. * Count wait execution in project.
  5. *
  6. * 范围:project
  7. * 对象:execution
  8. * 目的:scale
  9. * 度量名称:按项目统计的未开始执行数
  10. * 单位:个
  11. * 描述:按项目统计的未开始执行数表示在项目中未开始的执行数,可以用来了解未开始的执行数量。
  12. * 定义:项目的执行个数求和;状态为未开始;过滤已删除的执行;过滤已删除的项目;
  13. *
  14. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  15. * @author qixinzhi <qixinzhi@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_wait_execution_in_project extends baseCalc
  22. {
  23. public $dataset = 'getExecutions';
  24. public $fieldList = array('t1.project', 't1.status');
  25. public $result = array();
  26. public function calculate($row)
  27. {
  28. $project = $row->project;
  29. $status = $row->status;
  30. if(!isset($this->result[$project])) $this->result[$project] = 0;
  31. if($status == 'wait') $this->result[$project] += 1;
  32. }
  33. public function getResult($options = array())
  34. {
  35. $records = $this->getRecords(array('project', 'value'));
  36. return $this->filterByOptions($records, $options);
  37. }
  38. }