* Adjust page.
This commit is contained in:
@@ -884,15 +884,24 @@ class programModel extends model
|
||||
{
|
||||
/* Init vars. */
|
||||
$projects = $this->getProjectList($programID, $browseType, $queryID, $orderBy, $pager, $programTitle, $involved, $queryAll);
|
||||
|
||||
if(empty($projects)) return array();
|
||||
|
||||
$projectKeys = array_keys($projects);
|
||||
$stats = array();
|
||||
$hours = array();
|
||||
$emptyHour = array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0);
|
||||
$leftTasks = array();
|
||||
$teamMembers = array();
|
||||
|
||||
$executions = $this->dao->select('id')->from(TABLE_EXECUTION)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('project')->in($projectKeys)
|
||||
->andWhere('type')->in('sprint,stage')
|
||||
->fetchAll('id');
|
||||
|
||||
/* Get all tasks and compute totalEstimate, totalConsumed, totalLeft, progress according to them. */
|
||||
$tasks = $this->dao->select('id, project, estimate, consumed, `left`, status, closedReason')
|
||||
$tasks = $this->dao->select('id, project, estimate, consumed, `left`, status, closedReason, execution')
|
||||
->from(TABLE_TASK)
|
||||
->where('project')->in($projectKeys)
|
||||
->andWhere('parent')->lt(1)
|
||||
@@ -905,9 +914,9 @@ class programModel extends model
|
||||
$hour = (object)$emptyHour;
|
||||
foreach($projectTasks as $task)
|
||||
{
|
||||
$hour->totalEstimate += $task->estimate;
|
||||
if(in_array($task->execution, array_keys($executions))) $hour->totalEstimate += $task->estimate;
|
||||
$hour->totalConsumed += $task->consumed;
|
||||
if($task->status != 'cancel' and $task->status != 'closed') $hour->totalLeft += $task->left;
|
||||
if($task->status != 'cancel' and $task->status != 'closed' and in_array($task->execution, array_keys($executions))) $hour->totalLeft += $task->left;
|
||||
}
|
||||
$hours[$projectID] = $hour;
|
||||
}
|
||||
@@ -922,6 +931,17 @@ class programModel extends model
|
||||
$hour->progress = $hour->totalReal ? round($hour->totalConsumed / $hour->totalReal, 2) * 100 : 0;
|
||||
}
|
||||
|
||||
/* Get the number of lefting tasks. */
|
||||
if($this->cookie->projectType and $this->cookie->projectType == 'bycard')
|
||||
{
|
||||
$leftTasks = $this->dao->select('project,count(*) as tasks')->from(TABLE_TASK)
|
||||
->where('project')->in($projectKeys)
|
||||
->andWhere('status')->notIn('cancel,closed')
|
||||
->andWhere('execution')->in(array_keys($executions))
|
||||
->groupBy('project')
|
||||
->fetchAll('project');
|
||||
}
|
||||
|
||||
/* Get the number of project teams. */
|
||||
$teams = $this->dao->select('root,count(*) as teams')->from(TABLE_TEAM)
|
||||
->where('root')->in($projectKeys)
|
||||
@@ -929,6 +949,15 @@ class programModel extends model
|
||||
->groupBy('root')
|
||||
->fetchAll('root');
|
||||
|
||||
/* Get the members of project teams. */
|
||||
if($this->cookie->projectType and $this->cookie->projectType == 'bycard')
|
||||
{
|
||||
$teamMembers = $this->dao->select('root,account')->from(TABLE_TEAM)
|
||||
->where('root')->in($projectKeys)
|
||||
->andWhere('type')->eq('project')
|
||||
->fetchGroup('root', 'account');
|
||||
}
|
||||
|
||||
/* Process projects. */
|
||||
foreach($projects as $key => $project)
|
||||
{
|
||||
@@ -944,7 +973,9 @@ class programModel extends model
|
||||
/* Process the hours. */
|
||||
$project->hours = isset($hours[$project->id]) ? $hours[$project->id] : (object)$emptyHour;
|
||||
|
||||
$project->teamCount = isset($teams[$project->id]) ? $teams[$project->id]->teams : 0;
|
||||
$project->teamCount = isset($teams[$project->id]) ? $teams[$project->id]->teams : 0;
|
||||
$project->leftTasks = isset($leftTasks[$project->id]) ? $leftTasks[$project->id]->tasks : '—';
|
||||
$project->teamMembers = isset($teamMembers[$project->id]) ? array_keys($teamMembers[$project->id]) : array();
|
||||
$stats[$key] = $project;
|
||||
}
|
||||
return $stats;
|
||||
|
||||
@@ -52,24 +52,25 @@
|
||||
<th class="w-300px" colspan="4"><?php echo $lang->story->requirement;?></th>
|
||||
<?php endif;?>
|
||||
<th class="w-300px" colspan="4"><?php echo $lang->story->story;?></th>
|
||||
<th class="w-150px" colspan="2"><?php echo $lang->bug->common;?></th>
|
||||
<th class="w-80px" rowspan="2"><?php echo $lang->product->release;?></th>
|
||||
<th class="w-150px" colspan="3"><?php echo $lang->bug->common;?></th>
|
||||
<th class="w-80px" rowspan="2"><?php echo $lang->product->plan;?></th>
|
||||
<th class="w-80px" rowspan="2"><?php echo $lang->product->release;?></th>
|
||||
<th class='c-actions w-70px' rowspan="2"><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
<tr class="text-center">
|
||||
<?php if($this->config->URAndSR):?>
|
||||
<th style="border-left: 1px solid #ddd;"><?php echo $lang->story->activate;?></th>
|
||||
<th><?php echo $lang->story->close;?></th>
|
||||
<th><?php echo $lang->story->draft;?></th>
|
||||
<th style="border-left: 1px solid #ddd;"><?php echo $lang->story->draft;?></th>
|
||||
<th><?php echo $lang->story->activate;?></th>
|
||||
<th><?php echo $lang->story->change;?></th>
|
||||
<th><?php echo $lang->story->completeRate;?></th>
|
||||
<?php endif;?>
|
||||
<th style="border-left: 1px solid #ddd;"><?php echo $lang->story->activate;?></th>
|
||||
<th><?php echo $lang->story->close;?></th>
|
||||
<th><?php echo $lang->story->draft;?></th>
|
||||
<th style="border-left: 1px solid #ddd;"><?php echo $lang->story->draft;?></th>
|
||||
<th><?php echo $lang->story->activate;?></th>
|
||||
<th><?php echo $lang->story->change;?></th>
|
||||
<th><?php echo $lang->story->completeRate;?></th>
|
||||
<th style="border-left: 1px solid #ddd;"><?php echo $lang->bug->activate;?></th>
|
||||
<th><?php echo $lang->close;?></th>
|
||||
<th><?php echo $lang->bug->repairRate;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sortable" id="productTableList">
|
||||
@@ -88,19 +89,20 @@
|
||||
</td>
|
||||
<td class="c-name" title='<?php echo $product->name?>'><?php echo html::a($this->createLink('product', 'browse', 'product=' . $product->id), $product->name);?></td>
|
||||
<?php if($this->config->URAndSR):?>
|
||||
<td><?php echo $product->requirements['active'];?></td>
|
||||
<td><?php echo $product->requirements['closed'];?></td>
|
||||
<td><?php echo $product->requirements['draft'];?></td>
|
||||
<td><?php echo $product->requirements['active'];?></td>
|
||||
<td><?php echo $product->requirements['changed'];?></td>
|
||||
<td><?php echo $totalRequirements == 0 ? 0 : round($product->requirements['closed'] / $totalRequirements, 3) * 100;?>%</td>
|
||||
<?php endif;?>
|
||||
<td><?php echo $product->stories['active'];?></td>
|
||||
<td><?php echo $product->stories['closed'];?></td>
|
||||
<td><?php echo $product->stories['draft'];?></td>
|
||||
<td><?php echo $product->stories['active'];?></td>
|
||||
<td><?php echo $product->stories['changed'];?></td>
|
||||
<td><?php echo $totalStories == 0 ? 0 : round($product->stories['closed'] / $totalStories, 3) * 100;?>%</td>
|
||||
<td><?php echo $product->unResolved;?></td>
|
||||
<td><?php echo $product->closedBugs;?></td>
|
||||
<td><?php echo $product->releases;?></td>
|
||||
<td><?php echo ($product->unResolved + $product->fixedBugs) == 0 ? 0 : round($product->fixedBugs / ($product->unResolved + $product->fixedBugs), 3) * 100;?>%</td>
|
||||
<td><?php echo $product->plans;?></td>
|
||||
<td><?php echo $product->releases;?></td>
|
||||
<td class='c-actions'>
|
||||
<?php common::printIcon('product', 'edit', "product=$product->id&action=edit&extra=&programID=$program->id", $product, 'list', 'edit');?>
|
||||
<?php if($canOrder):?>
|
||||
|
||||
Reference in New Issue
Block a user