From 94bf6a70a2f8dc65a9e6eeb1674b9df5cefbb747 Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 13 May 2022 00:44:07 +0000 Subject: [PATCH] * Adjust code --- module/program/control.php | 4 +--- module/program/model.php | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/module/program/control.php b/module/program/control.php index 2c3631f536..9c5db15563 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -52,9 +52,7 @@ class program extends control else { $topPrograms = $this->program->getList($status, $orderBy, $pager, 'top'); - $programIds = array(); - foreach($topPrograms as $programID => $program) $programIds[] = $programID; - $programs = $this->program->getList($status, $orderBy, null, 'child', $programIds); + $programs = $this->program->getList($status, $orderBy, null, 'child', $topPrograms); /* Get summary. */ $topCount = $indCount = 0; diff --git a/module/program/model.php b/module/program/model.php index 8cbf51dbc0..457cdea101 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -140,9 +140,9 @@ class programModel extends model $projectIdList = array(); if($type === 'child') { - foreach($idList as $topID) + foreach($idList as $topID => $topProgram) { - $projectIdList += $this->dao->select('id')->from(TABLE_PROGRAM)->Where('path')->like(",$topID,%")->fetchPairs('id'); + $projectIdList += $topProgram->type == 'project' ? array($topID => $topID) : $this->dao->select('id')->from(TABLE_PROGRAM)->Where('path')->like(",$topID,%")->fetchPairs('id'); } }