* Refactor getKanbanTasks method and case.
This commit is contained in:
@@ -4559,22 +4559,23 @@ class executionModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Kanban tasks
|
||||
* 获取看板的任务卡片数据。
|
||||
* Get the Kanban task card data.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param array|string $excludeTasks
|
||||
* @param int $executionID
|
||||
* @param string $orderBy
|
||||
* @param object|null $pager
|
||||
* @param array $excludeTasks
|
||||
* @access public
|
||||
* @return void
|
||||
* @return array
|
||||
*/
|
||||
public function getKanbanTasks($executionID, $orderBy = 'status_asc, id_desc', $pager = null, $excludeTasks = '')
|
||||
public function getKanbanTasks(int $executionID, string $orderBy = 'status_asc, id_desc', array $excludeTasks = array(), object|null $pager = null): array
|
||||
{
|
||||
$tasks = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus, t3.realname AS assignedToRealName')
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
|
||||
->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account')
|
||||
->where('t1.execution')->eq((int)$executionID)
|
||||
->where('t1.execution')->eq($executionID)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t1.parent')->ge(0)
|
||||
->beginIF($excludeTasks)->andWhere('t1.id')->notIN($excludeTasks)->fi()
|
||||
|
||||
@@ -2131,16 +2131,18 @@ class executionTest
|
||||
}
|
||||
|
||||
/**
|
||||
* function getKanbanTasks test by execution
|
||||
* 获取看板的任务卡片数据。
|
||||
* Get the Kanban task card data.
|
||||
*
|
||||
* @param string $executionID
|
||||
* @param string $count
|
||||
* @param int $executionID
|
||||
* @param int $count
|
||||
* @param array $excludeTasks
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array|int
|
||||
*/
|
||||
public function getKanbanTasksTest($executionID, $count)
|
||||
public function getKanbanTasksTest(int $executionID, int $count, array $excludeTasks = array()): array|int
|
||||
{
|
||||
$object = $this->executionModel->getKanbanTasks($executionID);
|
||||
$object = $this->executionModel->getKanbanTasks($executionID, 'id_desc', $excludeTasks);
|
||||
|
||||
if(dao::isError())
|
||||
{
|
||||
|
||||
@@ -30,25 +30,25 @@ $task->gen(30);
|
||||
/**
|
||||
|
||||
title=测试executionModel->getKanbanTasksTest();
|
||||
timeout=0
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
敏捷执行查询 >> 任务25,5
|
||||
瀑布执行查询 >> 任务29,7
|
||||
看板执行查询 >> 任务21,9
|
||||
敏捷执行查询统计 >> 10
|
||||
瀑布执行查询统计 >> 10
|
||||
看板执行查询统计 >> 10
|
||||
|
||||
*/
|
||||
|
||||
$executionIDList = array(5, 7, 9);
|
||||
$count = array('0', '1');
|
||||
$executionIDList = array(5, 7, 9);
|
||||
$count = array('0', '1');
|
||||
$excludeTaskIdList = array(21, 25, 29);
|
||||
|
||||
$executionTester = new executionTest();
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[0], $count[0])) && p('25:name,execution') && e('任务25,5'); // 敏捷执行查询
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[1], $count[0])) && p('29:name,execution') && e('任务29,7'); // 瀑布执行查询
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[2], $count[0])) && p('21:name,execution') && e('任务21,9'); // 看板执行查询
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[0], $count[1])) && p() && e('10'); // 敏捷执行查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[1], $count[1])) && p() && e('10'); // 瀑布执行查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[2], $count[1])) && p() && e('10'); // 看板执行查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[0], $count[0])) && p('25:name,execution') && e('任务25,5'); // 敏捷执行查询
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[1], $count[0])) && p('29:name,execution') && e('任务29,7'); // 瀑布执行查询
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[2], $count[0])) && p('21:name,execution') && e('任务21,9'); // 看板执行查询
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[0], $count[1])) && p() && e('10'); // 敏捷执行查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[1], $count[1])) && p() && e('10'); // 瀑布执行查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[2], $count[1])) && p() && e('10'); // 看板执行查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[0], $count[0], $excludeTaskIdList)) && p('1:name,execution') && e('任务1,5'); // 敏捷执行查询不包括任务25
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[1], $count[0], $excludeTaskIdList)) && p('2:name,execution') && e('任务2,7'); // 瀑布执行查询不包括任务29
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[2], $count[0], $excludeTaskIdList)) && p('3:name,execution') && e('任务3,9'); // 看板执行查询不包括任务21
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[0], $count[1], $excludeTaskIdList)) && p() && e('9'); // 敏捷执行不包括任务25查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[1], $count[1], $excludeTaskIdList)) && p() && e('9'); // 瀑布执行不包括任务29查询统计
|
||||
r($executionTester->getKanbanTasksTest($executionIDList[2], $count[1], $excludeTaskIdList)) && p() && e('9'); // 看板执行不包括任务21查询统计
|
||||
|
||||
@@ -2992,7 +2992,7 @@ class kanbanModel extends model
|
||||
}
|
||||
elseif($laneType == 'task')
|
||||
{
|
||||
$tasks = $this->loadModel('execution')->getKanbanTasks($executionID, 'status_asc, id_desc', null, $otherCardList);
|
||||
$tasks = $this->loadModel('execution')->getKanbanTasks($executionID, 'status_asc, id_desc', explode(',', $otherCardList));
|
||||
foreach($tasks as $taskID => $task)
|
||||
{
|
||||
foreach($this->config->kanban->taskColumnStatusList as $colType => $status)
|
||||
|
||||
Reference in New Issue
Block a user