diff --git a/module/metric/calc/product/scale/count_of_story_in_pri_in_product.php b/module/metric/calc/product/scale/count_of_story_in_pri_in_product.php new file mode 100644 index 0000000000..74d8550157 --- /dev/null +++ b/module/metric/calc/product/scale/count_of_story_in_pri_in_product.php @@ -0,0 +1,50 @@ + + * @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_story_in_pri_in_product extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = array(); + + public function calculate($row) + { + if(!isset($this->result[$row->pri])) $this->result[$row->pri] = array(); + $this->result[$row->pri][$row->id] = $row->id; + } + + public function getResult($options = array()) + { + foreach($this->result as $pri => $stories) + { + if(!is_array($stories)) + { + unset($this->result[$pri]); + continue; + } + $this->result[$pri] = count($stories); + } + + $records = $this->getRecords(array('pri', 'value')); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/calc/product/scale/count_of_story_in_source_in_product.php b/module/metric/calc/product/scale/count_of_story_in_source_in_product.php new file mode 100644 index 0000000000..57761f2d2b --- /dev/null +++ b/module/metric/calc/product/scale/count_of_story_in_source_in_product.php @@ -0,0 +1,50 @@ + + * @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_story_in_source_in_product extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = array(); + + public function calculate($row) + { + if(!isset($this->result[$row->source])) $this->result[$row->source] = array(); + $this->result[$row->source][$row->id] = $row->id; + } + + public function getResult($options = array()) + { + foreach($this->result as $source => $stories) + { + if(!is_array($stories)) + { + unset($this->result[$source]); + continue; + } + $this->result[$source] = count($stories); + } + + $records = $this->getRecords(array('source', 'value')); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/calc/product/scale/count_of_story_in_status_in_product.php b/module/metric/calc/product/scale/count_of_story_in_status_in_product.php new file mode 100644 index 0000000000..11a517eb98 --- /dev/null +++ b/module/metric/calc/product/scale/count_of_story_in_status_in_product.php @@ -0,0 +1,50 @@ + + * @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_story_in_status_in_product extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = array(); + + public function calculate($row) + { + if(!isset($this->result[$row->status])) $this->result[$row->status] = array(); + $this->result[$row->status][$row->id] = $row->id; + } + + public function getResult($options = array()) + { + foreach($this->result as $status => $stories) + { + if(!is_array($stories)) + { + unset($this->result[$status]); + continue; + } + $this->result[$status] = count($stories); + } + + $records = $this->getRecords(array('status', 'value')); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/calc/product/scale/count_of_story_in_type_in_product.php b/module/metric/calc/product/scale/count_of_story_in_type_in_product.php new file mode 100644 index 0000000000..7c8d88dc8c --- /dev/null +++ b/module/metric/calc/product/scale/count_of_story_in_type_in_product.php @@ -0,0 +1,50 @@ + + * @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_story_in_type_in_product extends baseCalc +{ + public $dataset = ''; + + public $fieldList = array(); + + public $result = array(); + + public function calculate($row) + { + if(!isset($this->result[$row->type])) $this->result[$row->type] = array(); + $this->result[$row->type][$row->id] = $row->id; + } + + public function getResult($options = array()) + { + foreach($this->result as $type => $stories) + { + if(!is_array($stories)) + { + unset($this->result[$type]); + continue; + } + $this->result[$type] = count($stories); + } + + $records = $this->getRecords(array('type', 'value')); + return $this->filterByOptions($records, $options); + } +} diff --git a/module/metric/calc/user/scale/count_of_story_in_user.php b/module/metric/calc/user/scale/count_of_story_in_user.php new file mode 100755 index 0000000000..e552b178c8 --- /dev/null +++ b/module/metric/calc/user/scale/count_of_story_in_user.php @@ -0,0 +1,40 @@ + + * @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_story_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] = 0; + $this->result[$row->openedBy] += 1; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('user', 'value')); + return $this->filterByOptions($records, $options); + } +}