From 623f2b57f97328f634ef53fb28293a23f468b05c Mon Sep 17 00:00:00 2001 From: daitingting Date: Thu, 25 May 2023 02:36:56 +0000 Subject: [PATCH] * Refactor getDataOfOpenedBugsPerDayTest. --- module/bug/model.php | 2 +- module/bug/test/bug.class.php | 16 ++++++---------- .../bug/test/model/getdataofopenedbugsperday.php | 13 ++++++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 26ef98bee8..37bcb2870b 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1907,7 +1907,7 @@ class bugModel extends model */ public function getDataOfOpenedBugsPerDay(): array { - return $this->dao->select('DATE_FORMAT(openedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->reportCondition())->groupBy('name')->orderBy('openedDate')->fetchAll(); + return $this->dao->select('DATE_FORMAT(openedDate, "%Y-%m-%d") AS name, COUNT(*) AS value')->from(TABLE_BUG)->where($this->reportCondition())->groupBy('name')->orderBy('name')->fetchAll(); } /** diff --git a/module/bug/test/bug.class.php b/module/bug/test/bug.class.php index 37b859e798..3fca76ec74 100644 --- a/module/bug/test/bug.class.php +++ b/module/bug/test/bug.class.php @@ -1631,23 +1631,19 @@ class bugTest } /** + * 统计每天新增 bug 数。 * Test get report data of opened bugs per day. * * @access public * @return array */ - public function getDataOfOpenedBugsPerDayTest() + public function getDataOfOpenedBugsPerDayTest(): array { - $array = $this->objectModel->getDataOfOpenedBugsPerDay(); + $datas = $this->objectModel->getDataOfOpenedBugsPerDay(); - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $array; - } + if(dao::isError()) return dao::getError(); + + return $datas; } /** diff --git a/module/bug/test/model/getdataofopenedbugsperday.php b/module/bug/test/model/getdataofopenedbugsperday.php index bb861cbb45..27baf46118 100755 --- a/module/bug/test/model/getdataofopenedbugsperday.php +++ b/module/bug/test/model/getdataofopenedbugsperday.php @@ -1,17 +1,20 @@ #!/usr/bin/env php gen(10); /** title=bugModel->getDataOfOpenedBugsPerDay(); +timeout=0 cid=1 -pid=1 -获取创建的数据 >> 23 +- 获取创建的数据第0条的value属性 @1 */ -$bug=new bugTest(); -r($bug->getDataOfOpenedBugsPerDayTest()) && p('0:value') && e('23'); // 获取创建的数据 \ No newline at end of file +$bug = new bugTest(); +r($bug->getDataOfOpenedBugsPerDayTest()) && p('0:value') && e('1'); //获取创建的数据 \ No newline at end of file