diff --git a/module/metric/calc/user/scale/count_of_wait_ticket_in_user.php b/module/metric/calc/user/scale/count_of_wait_ticket_in_user.php new file mode 100755 index 0000000000..7a9e9a901f --- /dev/null +++ b/module/metric/calc/user/scale/count_of_wait_ticket_in_user.php @@ -0,0 +1,44 @@ + + * @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_wait_ticket_in_user extends baseCalc +{ + public $dataset = 'getAllTickets'; + + public $fieldList = array('t1.status', 't1.assignedTo'); + + public $result = array(); + + public function calculate($row) + { + $assignedTo = $row->assignedTo; + + if(empty($assignedTo) || $assignedTo == 'closed' || $row->status != 'wait') return false; + + if(!isset($this->result[$assignedTo])) $this->result[$assignedTo] = 0; + $this->result[$assignedTo] += 1; + } + + public function getResult($options = array()) + { + $records = $this->getRecords(array('user', 'value')); + return $this->filterByOptions($records, $options); + } +}