* Refactor getDataOfTasksPerLeft method.
This commit is contained in:
@@ -2230,12 +2230,13 @@ class taskModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report data of tasks per left
|
||||
* 获取按剩余时间统计的报表数据。
|
||||
* Get report data of tasks per left.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
* @return object[]
|
||||
*/
|
||||
public function getDataOfTasksPerLeft()
|
||||
public function getDataOfTasksPerLeft(): array
|
||||
{
|
||||
$tasks = $this->dao->select('id,`left`')->from(TABLE_TASK)->alias('t1')
|
||||
->where($this->reportCondition())
|
||||
|
||||
@@ -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->getDataOfTasksPerLeft();
|
||||
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->getDataOfTasksPerLeftTest()) && p('0:name,value') && e('0,83'); //统计剩余工时为0的任务数量
|
||||
r($task->getDataOfTasksPerLeftTest()) && p('1:name,value') && e('1,83'); //统计剩余工时为1的任务数量
|
||||
r($task->getDataOfTasksPerLeftTest()) && p('2:name,value') && e('2,83'); //统计剩余工时为2的任务数量
|
||||
r($task->getDataOfTasksPerLeftTest()) && p('3:name,value') && e('3,83'); //统计剩余工时为3的任务数量
|
||||
r($task->getDataOfTasksPerLeftTest()) && p('4:name,value') && e('4,83'); //统计剩余工时为4的任务数量
|
||||
r($task->getDataOfTasksPerLeftTest()) && p('5:name,value') && e('5,83'); //统计剩余工时为5的任务数量
|
||||
r($task->getDataOfTasksPerLeftTest()) && p('6:name,value') && e('6,82'); //统计剩余工时为6的任务数量
|
||||
r($task->getDataOfTasksPerLeftTest()) && p('7:name,value') && e('7,82'); //统计剩余工时为7的任务数量
|
||||
global $tester;
|
||||
$taskModule = $tester->loadModel('task');
|
||||
|
||||
r(count($taskModule->getDataOfTasksPerLeft())) && p() && e('11'); // 按照剩余时间统计的数量
|
||||
r($taskModule->getDataOfTasksPerLeft()) && p('1:name,value') && e('1,3'); // 统计剩余工时为1的任务数量
|
||||
|
||||
@@ -923,26 +923,6 @@ class taskTest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get report data of tasks per left.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDataOfTasksPerLeftTest()
|
||||
{
|
||||
$object = $this->objectModel->getDataOfTasksPerLeft();
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
return dao::getError();
|
||||
}
|
||||
else
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get report data of tasks per consumed.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user