scale_of_valid_story.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * 按系统统计的有效研发需求规模数。
  4. * Scale of valid story.
  5. *
  6. * 范围:system
  7. * 对象:story
  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 scale_of_valid_story extends baseCalc
  22. {
  23. public $dataset = 'getAllDevStories';
  24. public $fieldList = array('t1.estimate', 't1.closedReason', 't1.parent', 't1.isParent');
  25. public $result = 0;
  26. public function calculate($row)
  27. {
  28. if($row->isParent == '1') return false;
  29. if(empty($row->estimate)) return null;
  30. if(!in_array($row->closedReason, array('duplicate', 'willnotdo', 'bydesign', 'cancel'))) $this->result += $row->estimate;
  31. }
  32. public function getResult($options = array())
  33. {
  34. $records = $this->getRecords(array('value'));
  35. return $this->filterByOptions($records, $options);
  36. }
  37. }