* [misc] Optimize the code for related object.

This commit is contained in:
xieqiyu
2024-11-29 17:09:35 +08:00
committed by 王于听
parent c8f39a7521
commit 8a54569740
4 changed files with 10 additions and 8 deletions
+3 -2
View File
@@ -161,9 +161,10 @@ class execution extends control
foreach($this->view->teamMembers as $key => $member) $memberPairs[$key] = $member->realname;
$memberPairs = $this->loadModel('user')->setCurrentUserFirst($memberPairs);
if($this->config->edition != 'open') $taskRelatedObject = $this->loadModel('custom')->getRelatedObjectList(array_keys($tasks), 'task', 'byRelation', true);
/* Append branches to task. */
$this->loadModel('task');
$this->loadModel('custom');
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($this->view->products));
foreach($tasks as $task)
{
@@ -183,7 +184,7 @@ class execution extends control
}
if(isset($branchGroups[$task->product][$task->branch])) $task->branch = $branchGroups[$task->product][$task->branch];
if($task->needConfirm) $task->status = 'changed';
if($this->config->edition != 'open') $task->relatedObject = $this->custom->getRelatedObjectList($task->id, 'task', 'byRelation', true);
if($this->config->edition != 'open') $task->relatedObject = zget($taskRelatedObject, $task->id, 0);
}
$showAllModule = empty($this->config->execution->task->allModule) ? '' : 'allModule';