* Finish task#8494.
This commit is contained in:
+18
-21
@@ -955,31 +955,27 @@ class projectModel extends model
|
||||
*/
|
||||
public function getExecutionStats($projectID = 0, $status = 'undone', $productID = 0, $branch = 0, $itemCounts = 30, $orderBy = 'order_desc', $pager = null)
|
||||
{
|
||||
/* Init vars. */
|
||||
$executions = $this->getExecutionList($projectID, $status, 0, $productID, $branch);
|
||||
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)
|
||||
->where('id')->in(array_keys($executions))
|
||||
->andWhere('grade')->eq(1)
|
||||
->andWhere('deleted')->eq('0')
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
|
||||
if(empty($executions)) return array();
|
||||
|
||||
/* In case of a waterfall model, obtain sub-stage data. */
|
||||
$project = $this->loadModel('program')->getPRJById($this->session->PRJ);
|
||||
if($project and $project->model == 'waterfall')
|
||||
if(empty($productID))
|
||||
{
|
||||
$childrens = $this->dao->select('*')->from(TABLE_PROJECT)
|
||||
->where('parent')->in(array_keys($executions))
|
||||
->andWhere('grade')->eq(2)
|
||||
$executions = $this->dao->select('*')->from(TABLE_EXECUTION)
|
||||
->where('project')->eq($projectID)
|
||||
->andWhere('type')->eq('stage')
|
||||
->andWhere('deleted')->eq('0')
|
||||
->orderBy($orderBy)
|
||||
->orderBy('path_desc,id_asc')
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$executions = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project=t2.id')
|
||||
->where('t1.product')->eq($productID)
|
||||
->andWhere('t2.project')->eq($projectID)
|
||||
->andWhere('t2.type')->eq('stage')
|
||||
->andWhere('t2.deleted')->eq('0')
|
||||
->orderBy('t2.parent_desc,t2.id_asc')
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
|
||||
$executions += $childrens;
|
||||
}
|
||||
|
||||
$hours = array();
|
||||
@@ -1074,6 +1070,7 @@ class projectModel extends model
|
||||
}
|
||||
|
||||
/* In the case of the waterfall model, calculate the sub-stage. */
|
||||
$project = $this->loadModel('program')->getPRJById($this->session->PRJ);
|
||||
if($project and $project->model == 'waterfall')
|
||||
{
|
||||
foreach($parents as $id => $execution) $execution->children = isset($children[$id]) ? $children[$id] : array();
|
||||
|
||||
Reference in New Issue
Block a user