From fcc4837af0ff6b27f33431b3fa22860433fb0cda Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 16 Feb 2023 10:01:44 +0800 Subject: [PATCH] * Code for finish task #84578. --- module/execution/model.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index d69cd9a9b6..e28e477b95 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1629,9 +1629,10 @@ class executionModel extends model /* Process executions. */ $this->app->loadConfig('task'); - $emptyHour = array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0); - $today = helper::today(); - $childList = array(); + $emptyHour = array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0); + $today = helper::today(); + $childList = array(); + $parentList = array(); foreach($executions as $key => $execution) { $execution->productName = isset($productNameList[$execution->id]) ? $productNameList[$execution->id] : ''; @@ -1664,7 +1665,7 @@ class executionModel extends model /* In the case of the waterfall model, calculate the sub-stage. */ if($param === 'skipParent') { - if($execution->parent < 0 and $execution->type == 'stage') unset($executions[$key]); + if($execution->parent) $parentList[$execution->parent] = $execution->parent; if($execution->projectName) $execution->name = $execution->projectName . ' / ' . $execution->name; } elseif($param === 'hasParentName') @@ -1672,13 +1673,10 @@ class executionModel extends model $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]->title = implode('/', $parentExecutions); } - else + elseif(isset($executions[$execution->parent])) { - if(isset($executions[$execution->parent])) - { - $executions[$execution->parent]->children[$key] = $execution; - $childList[$key] = $key; - } + $executions[$execution->parent]->children[$key] = $execution; + $childList[$key] = $key; } /* Bind execution product */ @@ -1688,7 +1686,8 @@ class executionModel extends model } } - foreach($childList as $id) unset($executions[$id]); + foreach($childList as $childID) unset($executions[$childID]); + foreach($parentList as $parentID) unset($executions[$parentID]); return array_values($executions); }