From b684d521228b35c4dde4309260937b56756ddb8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Thu, 4 Nov 2021 11:29:55 +0800 Subject: [PATCH] * code for task #43770. --- api/v1/entries/reports.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/api/v1/entries/reports.php b/api/v1/entries/reports.php index 9864f6a09d..7d415b25a9 100644 --- a/api/v1/entries/reports.php +++ b/api/v1/entries/reports.php @@ -60,6 +60,16 @@ class reportsEntry extends entry { $report['bugProgress'] = $this->bugProgress(); } + elseif($field == 'bugprogress') + { + $report['bugProgress'] = $this->bugProgress(); + } + elseif($field == 'output') + { + $this->loadModel('report'); + $storyStat = $this->report->getYearObjectStat($accounts, $year, 'story'); + $report['output']['story'] = $this->processStatus($storyStat['statusStat'], 'story'); + } } return $this->send(200, $report); @@ -230,7 +240,7 @@ class reportsEntry extends entry if(isset($productStatusList[$product->status])) $productStatusList[$product->status]['total'] += 1; } - $storyStatusList = array('draft' => array(), 'active' => array(), 'closed' => array(), 'changed' => array()); + $storyStatusList = array('draft' => array(), 'active' => array(), 'changed' => array(), 'closed' => array()); foreach($processedProducts as $productID => $product) { $product->storyStat = array(); @@ -320,4 +330,23 @@ class reportsEntry extends entry return array('productStatusList' => $productStatusList, 'bugs' => array_values($processedProducts), 'bugStatusList' => $bugStatusList); } + + public function processStatus($statusStat, $objectType) + { + $this->app->loadLang($objectType); + + $processedStatus = array(); + $total = 0; + foreach($this->lang->$objectType->statusList as $status => $statusName) + { + if(empty($statusStat[$status])) continue; + + $processedStatus[$status]['code'] = $status; + $processedStatus[$status]['name'] = $statusName; + $processedStatus[$status]['total'] = $statusStat[$status]; + $total += $statusStat[$status]; + } + + return array('total' => $total, 'statusList' => array_values($processedStatus)); + } }