rate_of_fixed_bug.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * 按系统统计的Bug修复率。
  4. * Rate of fixed bug.
  5. *
  6. * 范围:system
  7. * 对象:bug
  8. * 目的:rate
  9. * 度量名称:按系统统计的Bug修复率
  10. * 单位:%
  11. * 描述:按系统统计的Bug修复率是指已修复的Bug占相对于有效Bug数量的比例。反映了一个系统或软件中Bug修复的效率和速度,用于评估质量改进、故障管理、用户满意度、变更管理以及团队绩效评估与改进等方面。通过跟踪和分析Bug修复率,可以评估团队在修复Bug方面的效率和能力,及时发现和解决问题,提高系统的质量和可靠性。
  12. * 定义:复用:;按系统统计的已修复Bug数;按系统统计的有效Bug数;公式:;按系统统计的Bug修复率=按系统统计的已修复Bug数/按系统统计的有效Bug数;
  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 rate_of_fixed_bug extends baseCalc
  22. {
  23. public $dataset = 'getAllBugs';
  24. public $fieldList = array('t1.status', 't1.resolution');
  25. public $result = array('fixed' => 0, 'valid' => 0);
  26. public function calculate($row)
  27. {
  28. if($row->status == 'closed' and $row->resolution == 'fixed') $this->result['fixed'] += 1;
  29. if($row->status == 'active' or $row->resolution == 'fixed' or $row->resolution == 'postponed') $this->result['valid'] += 1;
  30. }
  31. public function getResult($options = array())
  32. {
  33. $valid = $this->result['valid'];
  34. $fixed = $this->result['fixed'];
  35. $rate = $valid == 0 ? 0 : round($fixed / $valid, 4);
  36. $records = array(array('value' => $rate));
  37. return $this->filterByOptions($records, $options);
  38. }
  39. }