From 0078006d282f3aef969d882d893138833065363a Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 21 Aug 2023 10:42:18 +0800 Subject: [PATCH] * Refactor getDataOfTasksPerEstimate method. --- module/task/model.php | 7 ++--- .../test/model/getdataoftasksperestimate.php | 27 ++++++------------- module/task/test/task.class.php | 20 -------------- 3 files changed, 12 insertions(+), 42 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index 8481d9fde9..9113dbad29 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -2212,12 +2212,13 @@ class taskModel extends model } /** - * Get report data of tasks per estimate + * 获取按预计时间统计的报表数据。 + * Get report data of tasks per estimate. * * @access public - * @return array + * @return object[] */ - public function getDataOfTasksPerEstimate() + public function getDataOfTasksPerEstimate(): array { $tasks = $this->dao->select('id,estimate')->from(TABLE_TASK)->alias('t1') ->where($this->reportCondition()) diff --git a/module/task/test/model/getdataoftasksperestimate.php b/module/task/test/model/getdataoftasksperestimate.php index d2140a6407..b2eebf2832 100755 --- a/module/task/test/model/getdataoftasksperestimate.php +++ b/module/task/test/model/getdataoftasksperestimate.php @@ -4,29 +4,18 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; include dirname(__FILE__, 2) . '/task.class.php'; su('admin'); +zdTable('task')->config('task')->gen(30); + /** title=taskModel->getDataOfTasksPerEstimate(); +timeout=0 cid=1 -pid=1 - -统计预计工时为0的任务数量 >> 0,83 -统计预计工时为1的任务数量 >> 1,83 -统计预计工时为2的任务数量 >> 2,83 -统计预计工时为3的任务数量 >> 3,83 -统计预计工时为4的任务数量 >> 4,83 -统计预计工时为5的任务数量 >> 5,83 -统计预计工时为6的任务数量 >> 6,82 -统计预计工时为7的任务数量 >> 7,82 */ -$task = new taskTest(); -r($task->getDataOfTasksPerEstimateTest()) && p('0:name,value') && e('0,83'); //统计预计工时为0的任务数量 -r($task->getDataOfTasksPerEstimateTest()) && p('1:name,value') && e('1,83'); //统计预计工时为1的任务数量 -r($task->getDataOfTasksPerEstimateTest()) && p('2:name,value') && e('2,83'); //统计预计工时为2的任务数量 -r($task->getDataOfTasksPerEstimateTest()) && p('3:name,value') && e('3,83'); //统计预计工时为3的任务数量 -r($task->getDataOfTasksPerEstimateTest()) && p('4:name,value') && e('4,83'); //统计预计工时为4的任务数量 -r($task->getDataOfTasksPerEstimateTest()) && p('5:name,value') && e('5,83'); //统计预计工时为5的任务数量 -r($task->getDataOfTasksPerEstimateTest()) && p('6:name,value') && e('6,82'); //统计预计工时为6的任务数量 -r($task->getDataOfTasksPerEstimateTest()) && p('7:name,value') && e('7,82'); //统计预计工时为7的任务数量 +global $tester; +$taskModule = $tester->loadModel('task'); + +r(count($taskModule->getDataOfTasksPerEstimate())) && p() && e('11'); // 按预计工时统计的数量 +r($taskModule->getDataOfTasksPerEstimate()) && p('1:name,value') && e('1,3'); // 统计预计工时为1的任务数量 diff --git a/module/task/test/task.class.php b/module/task/test/task.class.php index 2e4a3610b0..66d0c25ae3 100755 --- a/module/task/test/task.class.php +++ b/module/task/test/task.class.php @@ -923,26 +923,6 @@ class taskTest } } - /** - * Test get report data of tasks per estimate. - * - * @access public - * @return array - */ - public function getDataOfTasksPerEstimateTest() - { - $object = $this->objectModel->getDataOfTasksPerEstimate(); - - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $object; - } - } - /** * Test get report data of tasks per left. *