count_of_requirement_in_project.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * 按项目统计的已关闭用户需求数。
  4. * Count of requirement in project.
  5. *
  6. * 范围:project
  7. * 对象:requirement
  8. * 目的:scale
  9. * 度量名称:按项目统计的户需求总数
  10. * 单位:个
  11. * 描述:按项目统计的用户需求总数是指项目中创建或关联的所有用户需求的数量,反映了项目的规模和复杂度,提供了关于用户需求管理、进度控制、资源规划、风险评估和质量控制的有用信息。
  12. * 定义:项目中用户需求个数求和 过滤已删除的用户需求 过滤已删除的项目。
  13. *
  14. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  15. * @author TingtingDai <daitingting@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_requirement_in_project extends baseCalc
  22. {
  23. public $dataset = 'getRequirementsWithProject';
  24. public $fieldList = array('t3.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. $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. }