diff --git a/module/block/control.php b/module/block/control.php index b91a1fa924..943a9e19dc 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -980,12 +980,14 @@ class block extends control $this->app->loadLang('story'); $this->app->loadLang('bug'); + $this->loadModel('program')->refreshStats(); + /* Set project status and count. */ $status = isset($this->params->type) ? $this->params->type : 'all'; $count = isset($this->params->count) ? (int)$this->params->count : 15; /* Get projects. */ - $projects = $this->project->getOverviewList('byStatus', $status, 'order_asc', $count, ''); + $projects = $this->project->getOverviewList('byStatus', $status, 'order_asc', $count, ''); if(empty($projects)) { $this->view->projects = $projects; @@ -1031,7 +1033,6 @@ class block extends control $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; } @@ -1282,6 +1283,9 @@ class block extends control public function printWaterfallReportBlock() { $this->app->loadLang('programplan'); + + $this->loadModel('program')->refreshStats(); + $project = $this->loadModel('project')->getByID($this->session->project); $today = helper::today(); $date = date('Ymd', strtotime('this week Monday')); @@ -1298,9 +1302,8 @@ class block extends control $this->view->sv = $this->weekly->getSV($this->view->ev, $this->view->pv); $this->view->cv = $this->weekly->getCV($this->view->ev, $this->view->ac); - $left = (float)$this->weekly->getLeft($this->session->project, $today); - $progress = ($this->view->ac + $left) ? floor($this->view->ac / ($this->view->ac + $left) * 1000) / 1000 * 100 : 0; - $this->view->progress = $progress > 100 ? 100 : $progress; + $left = (float)$this->weekly->getLeft($this->session->project, $today); + $this->view->progress = $project->progress > 100 ? 100 : $project->progress; $this->view->current = $current; } diff --git a/module/block/view/recentprojectblock.html.php b/module/block/view/recentprojectblock.html.php index cd3e14a250..c61426f361 100644 --- a/module/block/view/recentprojectblock.html.php +++ b/module/block/view/recentprojectblock.html.php @@ -101,7 +101,7 @@
createLink('execution', 'task', "executionID={$project->id}"), $project->name);?>
-
+
progress;?>%
diff --git a/module/common/view/kanban.html.php b/module/common/view/kanban.html.php index 04818b6019..bd94badc4c 100644 --- a/module/common/view/kanban.html.php +++ b/module/common/view/kanban.html.php @@ -197,7 +197,7 @@ function renderProjectItem(item, $item) { $progress = $('
').appendTo($item); } - var progress = Math.max(0, Math.min(100, Math.round(item.hours && !Array.isArray(item.hours) ? Math.round(item.hours.progress || 0) : 0))); + var progress = Math.max(0, Math.min(100, Math.round(item.progress ? Math.round(item.progress || 0) : 0))); $progress.find('span').text(progress); $progress.css('background-position-x', -Math.ceil(progress / 2) * 24); $item.addClass('has-progress'); diff --git a/module/program/model.php b/module/program/model.php index 23a351c494..03538d3a01 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -1389,19 +1389,6 @@ class programModel extends model } } - $this->loadModel('project'); - foreach($projects as $projectID => $project) - { - if($project->model != 'waterfall') continue; - - $projectStats = $this->project->getWaterfallPVEVAC($projectID); - $stats[$projectID]['totalEstimate'] = $projectStats['PV']; - $stats[$projectID]['totalConsumed'] = $projectStats['AC']; - $stats[$projectID]['totalLeft'] = $projectStats['left']; - $stats[$projectID]['totalConsumedNotDel'] = empty($project->deleted) ? $projectStats['AC'] : 0; - $stats[$projectID]['totalLeftNotDel'] = empty($project->deleted) ? $projectStats['left'] : 0; - } - foreach($teamMembers as $projectID => $teamCount) { if(!isset($stats[$projectID])) $stats[$projectID] = array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'teamCount' => 0, 'totalConsumedNotDel' => 0, 'totalLeftNotDel' => 0); diff --git a/module/project/view/view.html.php b/module/project/view/view.html.php index c1db43a220..4527a761da 100644 --- a/module/project/view/view.html.php +++ b/module/project/view/view.html.php @@ -204,10 +204,9 @@ - model == 'waterfall' ? $this->project->getWaterfallProgress($project->id) : (((float)$workhour->totalConsumed + (float)$workhour->totalLeft) ? floor($workhour->totalConsumed / ((float)$workhour->totalConsumed + (float)$workhour->totalLeft) * 1000) / 1000 * 100 : 0);?> - project->progress;?> percent;?>   + project->progress;?> progress . $lang->percent;?>  
-
+
diff --git a/module/upgrade/model.php b/module/upgrade/model.php index d7f3cb319a..d5dc7b36db 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -710,6 +710,7 @@ class upgradeModel extends model case '18_8': /* Upgrade members for testtask. */ $this->upgradeTesttaskMembers(); + $this->loadModel('program')->refreshStats(true); break; }