From 3ff5cf2231f90c81e883f89f5ece97abcc0a097d Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Fri, 2 Jun 2023 13:45:13 +0800 Subject: [PATCH] * Fix bug #35744. --- module/program/model.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/program/model.php b/module/program/model.php index 63846c4f28..b1fcb48292 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -638,11 +638,9 @@ class programModel extends model */ public function getProgressList($programIdList = array()) { - $programPairs = $this->getPairs(); - $projectStats = $this->getProjectStats(0, 'all', 0, 'id_desc', null, 0, 0, true); - + $programPairs = $this->getPairs(); $existProgramIdList = array_intersect($programIdList, array_keys($programPairs)); - $existProjectIdList = array_intersect($programIdList, array_keys($projectStats)); + $projectStats = $this->getProjectStats(0, 'all', 0, 'id_desc', null, 0, 0, true); $totalProgress = array(); $projectCount = array(); @@ -656,7 +654,7 @@ class programModel extends model $userPRJCount[$programID] = 0; $progressList[$programID] = 0; - foreach($existProjectIdList as $projectID) + foreach($projectStats as $projectID => $project) { if(strpos($projectStats[$projectID]->path, ",{$programID},") === false) continue; @@ -673,6 +671,8 @@ class programModel extends model } /* Add project progress. */ + /* First calculate the overall progress of the program, and then filter the unqualified projects. */ + $existProjectIdList = array_intersect($programIdList, array_keys($projectStats)); foreach($existProjectIdList as $projectID) $progressList[$projectID] = $projectStats[$projectID]->progress; return $progressList;