From a71a1b769637f6ba97966a4d7beea9efccae94bd Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 14 Aug 2023 13:50:36 +0800 Subject: [PATCH] * Fix bug #36051. --- module/block/control.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/block/control.php b/module/block/control.php index e1bc8252da..5905d4f179 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -1031,6 +1031,9 @@ class block extends control $project->sv = $this->weekly->getSV($project->ev, $project->pv); $project->cv = $this->weekly->getCV($project->ev, $project->ac); + $left = (float)$this->weekly->getLeft($project->id, $today); + $project->progress = ($project->ac + $left) ? floor($project->ac / ($project->ac + $left) * 1000) / 1000 * 100 : 0; + $project->progress = $project->progress > 100 ? 100 : $project->progress; $project->current = $current; } } @@ -1297,7 +1300,7 @@ class block extends control $this->view->cv = $this->weekly->getCV($this->view->ev, $this->view->ac); $left = (float)$this->weekly->getLeft($this->session->project, $today); - $progress = (!empty($this->view->ac) or !empty($left)) ? floor($this->view->ac / ($this->view->ac + $left) * 1000) / 1000 * 100 : 0; + $progress = ($this->view->ac + $left) ? floor($this->view->ac / ($this->view->ac + $left) * 1000) / 1000 * 100 : 0; $this->view->progress = $progress > 100 ? 100 : $progress; $this->view->current = $current; }