* Merge code.

This commit is contained in:
sgm0422
2020-06-15 17:12:17 +08:00
parent f28fd3f4cf
commit fc4d8db013
2 changed files with 38 additions and 0 deletions
+37
View File
@@ -982,6 +982,43 @@ class block extends control
$this->view->projects = $projects;
}
/**
* Print program statistic block.
*
* @access public
* @return void
*/
public function printProgramStatisticBlock()
{
$this->loadModel('program');
/* Get projects. */
$projects = $this->loadModel('project')->getList('all', 0, 0, 0, 'program');
$sprints = $this->project->getList();
$total = count($sprints);
foreach($projects as $project)
{
$project->sprints = 0;
foreach($this->lang->project->statusList as $key => $status)
{
$project->$key = new stdclass();
$project->$key->count = 0;
}
foreach($sprints as $sprint)
{
if($sprint->program == $project->id)
{
$project->sprints ++;
$project->{$sprint->status}->count ++;
}
}
foreach($this->lang->project->statusList as $key => $status) $project->$key->percent = $total ? round($project->$key->count / $total, 2) * 100 . '%' : '0%';
}
$this->view->projects = $projects;
}
/**
* Print qa statistic block.
*