From a8710ffd65378af99a50e9cd6c59fda31c993efe Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 29 Apr 2024 14:11:49 +0800 Subject: [PATCH] * Fix bug #48626. --- module/program/model.php | 2 +- module/program/tao.php | 5 +++-- module/project/ui/view.html.php | 24 ++++++------------------ 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/module/program/model.php b/module/program/model.php index ace6d35169..75e6067c0f 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -1341,8 +1341,8 @@ class programModel extends model ->where('t1.`date`')->ge($updateTime) ->andWhere('t1.project')->ne(0) ->fetchAll('project'); - if(empty($projects)) return; } + if(empty($projects)) return; /* 1. Refresh stats to db. */ $this->programTao->updateStats(array_keys($projects)); diff --git a/module/program/tao.php b/module/program/tao.php index c5a3f77419..6ac819ee45 100644 --- a/module/program/tao.php +++ b/module/program/tao.php @@ -336,10 +336,11 @@ class programTao extends programModel */ protected function setNoTaskExecution(array $projectIdList): array { - $summary = array(); + $summary = array(); + $executionGroup = $this->dao->select('id, project')->from(TABLE_PROJECT)->where('project')->in($projectIdList)->andWhere('deleted')->eq(0)->fetchGroup('project', 'id'); foreach($projectIdList as $projectID) { - $executions = $this->dao->select('id')->from(TABLE_PROJECT)->where('project')->eq($projectID)->andWhere('deleted')->eq(0)->fetchPairs(); + $executions = zget($executionGroup, $projectID, array()); foreach($executions as $executionID) { $taskCount = $this->dao->select('id')->from(TABLE_TASK) diff --git a/module/project/ui/view.html.php b/module/project/ui/view.html.php index 884faa1910..cdd337c6c4 100644 --- a/module/project/ui/view.html.php +++ b/module/project/ui/view.html.php @@ -34,18 +34,6 @@ if($project->grade > 1) ); } -$totalEstimate = $workhour->totalConsumed + $workhour->totalLeft; -$progress = 0; -if($project->model == 'waterfall') -{ - $progressList = $this->project->getWaterfallProgress(array($project->id)); - $progress = empty($progressList[$project->id]) ? 0 : $progressList[$project->id]; -} -elseif($totalEstimate > 0) -{ - $progress = floor($workhour->totalConsumed / $totalEstimate * 1000) / 1000 * 100; -} - $status = $this->processStatus('project', $project); $relatedProducts = null; @@ -184,13 +172,13 @@ row 'radius' => array('80%', '90%'), 'itemStyle' => array('borderRadius' => '40'), 'label' => array('show' => false), - 'data' => array($progress, 100 - $progress) + 'data' => array($project->progress, 100 - $project->progress) ))) ), div ( set::className('pie-chart-title text-center'), - div(span(set::className('text-2xl font-bold'), $progress . '%')), + div(span(set::className('text-2xl font-bold'), $project->progress . '%')), div ( span @@ -461,19 +449,19 @@ row ( setClass('w-1/3'), span(setClass('text-gray'), $lang->execution->estimateHours), - span(setClass('ml-2'), (float)$workhour->totalEstimate . 'h') + span(setClass('ml-2'), (float)$project->estimate . 'h') ), div ( setClass('w-1/3'), span(setClass('text-gray'), $lang->execution->consumedHours), - span(setClass('ml-2'), (float)$workhour->totalConsumed . 'h') + span(setClass('ml-2'), (float)$project->consumed . 'h') ), div ( setClass('w-1/3'), span(setClass('text-gray'), $lang->execution->leftHours), - span(setClass('ml-2'), (float)$workhour->totalLeft . 'h') + span(setClass('ml-2'), (float)$project->left . 'h') ), div ( @@ -485,7 +473,7 @@ row ( setClass('w-1/3 mt-4'), span(setClass('text-gray'), $lang->execution->totalHours), - span(setClass('ml-2'), (float)$workhour->totalLeft . 'h') + span(setClass('ml-2'), (float)$project->left . 'h') ), div (