rate_of_delivered_story.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * 按系统统计的研发需求交付率。
  4. * Rate of delivered story.
  5. *
  6. * 范围:system
  7. * 对象:story
  8. * 目的:rate
  9. * 度量名称:按系统统计的研发需求交付率
  10. * 单位:%
  11. * 描述:按系统统计的研发需求交付率反映了组织在研发过程中按时交付需求的能力和表现。用于评估组织对于评估交付能力、客户满意度和信任建立、项目管理和资源优化、竞争力和市场表现,以及持续改进和效率提升具有重要意义。
  12. * 定义:复用:;按系统统计的已交付研发需求数;按系统统计的有效研发需求数;公式:;按系统统计的研发需求完成率=按系统统计的已交付研发需求数/按系统统计的有效研发需求数*100%;
  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 rate_of_delivered_story extends baseCalc
  22. {
  23. public $dataset = 'getAllDevStories';
  24. public $fieldList = array('t1.closedReason', 't1.stage');
  25. public $result = array('valid' => 0, 'delivered' => 0);
  26. public function calculate($row)
  27. {
  28. if(!isset($this->result['delivered'])) $this->result['delivered'] = 0;
  29. if(!isset($this->result['valid'])) $this->result['valid'] = 0;
  30. if($row->stage == 'released' || $row->closedReason == 'done') $this->result['delivered'] ++;
  31. if(!in_array($row->closedReason, array('duplicate', 'willnotdo', 'bydesign', 'cancel'))) $this->result['valid'] ++;
  32. }
  33. public function getResult($options = array())
  34. {
  35. $this->result = !empty($this->result['valid']) ? round($this->result['delivered'] / $this->result['valid'], 4) : 0;
  36. $records = array(array('value' => $this->result));
  37. return $this->filterByOptions($records, $options);
  38. }
  39. }