diff --git a/module/metric/calc/user/scale/count_of_created_bug_in_user.php b/module/metric/calc/user/scale/count_of_created_bug_in_user.php new file mode 100755 index 0000000000..3f3c34b1e4 --- /dev/null +++ b/module/metric/calc/user/scale/count_of_created_bug_in_user.php @@ -0,0 +1,53 @@ + + * @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_created_bug_in_user extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = array(); + + public function calculate($row) + { + if(!isset($this->result[$row->openedBy])) $this->result[$row->openedBy] = array(); + $this->result[$row->openedBy][$row->id] = $row->id; + } + + public function getResult($options = array()) + { + foreach($this->result as $openedBy => $bugs) + { + if(!is_array($bugs)) + { + unset($this->result[$openedBy]); + continue; + } + + $this->result[$openedBy] = count($bugs); + } + + $records = $this->getRecords(array('user', 'value')); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/calc/user/scale/count_of_resolved_bug_in_user.php b/module/metric/calc/user/scale/count_of_resolved_bug_in_user.php new file mode 100755 index 0000000000..82b3b9a271 --- /dev/null +++ b/module/metric/calc/user/scale/count_of_resolved_bug_in_user.php @@ -0,0 +1,53 @@ + + * @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_resolved_bug_in_user extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = array(); + + public function calculate($row) + { + if(!isset($this->result[$row->resolvedBy])) $this->result[$row->resolvedBy] = array(); + $this->result[$row->resolvedBy][$row->id] = $row->id; + } + + public function getResult($options = array()) + { + foreach($this->result as $resolvedBy => $bugs) + { + if(!is_array($bugs)) + { + unset($this->result[$resolvedBy]); + continue; + } + + $this->result[$resolvedBy] = count($bugs); + } + + $records = $this->getRecords(array('user', 'value')); + return $this->filterByOptions($records, $options); + } +}