* @package * @uses func * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html) * @Link https://www.zentao.net */ class count_of_monthly_fixed_bug extends baseCalc { public $dataset = 'getAllBugs'; public $fieldList = array('t1.closedDate', 't1.status', 't1.resolution'); public $result = array(); public function calculate($row) { $closedDate = $row->closedDate; $year = $this->getYear($closedDate); if(!$year) return false; $month = substr($closedDate, 5, 2); if(!isset($this->result[$year])) $this->result[$year] = array(); if(!isset($this->result[$year][$month])) $this->result[$year][$month] = 0; if($row->status == 'closed' and $row->resolution == 'fixed') $this->result[$year][$month] += 1; } public function getResult($options = array()) { $records = $this->getRecords(array('year', 'month', 'value')); return $this->filterByOptions($records, $options); } }