From 5719c8c252bde427feb378df866211cb28e0e938 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 7 Feb 2023 11:02:46 +0800 Subject: [PATCH] * Optimize code for task #83948. --- module/execution/model.php | 7 ++++++- module/kanban/control.php | 9 +-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 779d9093d7..049d5cdb00 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1639,7 +1639,12 @@ class executionModel extends model if($execution->parent < 0 and $execution->type == 'stage') unset($executions[$key]); if($execution->projectName) $execution->name = $execution->projectName . ' / ' . $execution->name; } - elseif($param != 'importKanban') + elseif($param === 'hasParentName') + { + $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); + $executions[$execution->id]->name = implode('/', $parentExecutions); + } + else { if(isset($executions[$execution->parent]) and $execution->type == 'stage') { diff --git a/module/kanban/control.php b/module/kanban/control.php index 2e2ce68024..b7d34684d0 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1379,17 +1379,10 @@ class kanban extends control $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $executions = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, 'importKanban', 'id_asc', $pager); - foreach($executions as $execution) - { - $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); - $execution->name = implode('/', $parentExecutions); - } - $this->view->projects = array($this->lang->kanban->allProjects) + $this->project->getPairsByProgram('', 'all', false, '', '', '', 'multiple'); $this->view->selectedProjectID = $selectedProjectID; $this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID); - $this->view->executions2Imported = $executions; + $this->view->executions2Imported = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, 'hasParentName', 'id_asc', $pager); $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted'); $this->view->pager = $pager; $this->view->kanbanID = $kanbanID;