count_of_annual_fixed_bug.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * 按系统统计的年度修复Bug数。
  4. * Count of annual fixed bug.
  5. *
  6. * 范围:system
  7. * 对象:bug
  8. * 目的:scale
  9. * 度量名称:按系统统计的年度修复Bug数
  10. * 单位:个
  11. * 描述:按系统统计的年度修复Bug数是指在一年内解决并关闭的Bug数量。反映了一个系统或软件在一年内修复的Bug数量,用于评估系统质量改进、用户满意度、故障管理、变更管理和资源规划等方面。通过跟踪和分析年度修复Bug数,可以及时发现和解决问题,改善系统的质量和可靠性。同时,通过Bug修复数的评估,可以提高用户满意度、优化故障管理流程、控制变更质量,合理安排资源,从而提升整体的研发效果和项目交付质量。
  12. * 定义:所有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 count_of_annual_fixed_bug extends baseCalc
  22. {
  23. public $dataset = 'getAllBugs';
  24. public $fieldList = array('t1.closedDate', 't1.status', 't1.resolution');
  25. public $result = array();
  26. public function calculate($row)
  27. {
  28. $year = $this->getYear($row->closedDate);
  29. if(!$year) return false;
  30. if(!isset($this->result[$year])) $this->result[$year] = 0;
  31. if($row->status == 'closed' and $row->resolution == 'fixed') $this->result[$year] += 1;
  32. }
  33. public function getResult($options = array())
  34. {
  35. $records = $this->getRecords(array('year', 'value'));
  36. return $this->filterByOptions($records, $options);
  37. }
  38. }