Merge branch '15.6' into sprint/167

This commit is contained in:
王怡栋
2021-10-18 08:53:13 +08:00
2 changed files with 22 additions and 30 deletions
+5 -5
View File
@@ -1273,11 +1273,11 @@ class programModel extends model
/* Get the number of left 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')
$leftTasks = $this->dao->select('t2.parent as project, count(*) as tasks')->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
->where('t1.execution')->in(array_keys($executions))
->andWhere('t1.status')->notIn('cancel,closed')
->groupBy('t2.parent')
->fetchAll('project');
}
+17 -25
View File
@@ -213,10 +213,11 @@ class projectModel extends model
->groupBy('root')
->fetchAll('root');
$estimates = $this->dao->select('project, sum(estimate) as estimate')->from(TABLE_TASK)
->where('project')->in($projectIdList)
->andWhere('deleted')->eq(0)
->andWhere('parent')->lt(1)
$estimates = $this->dao->select('t2.parent as project, sum(estimate) as estimate')->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
->where('t2.parent')->in($projectIdList)
->andWhere('t1.deleted')->eq(0)
->andWhere('t1.parent')->lt(1)
->groupBy('project')
->fetchAll('project');
@@ -283,26 +284,20 @@ class projectModel extends model
->andWhere('type')->eq('project')
->groupBy('root')->fetchPairs();
$executionIdList = $this->dao->select('id')->from(TABLE_PROJECT)
->where('parent')->in($projectIdList)
->andWhere('deleted')->eq(0)
->fetchPairs();
$hours = $this->dao->select('project,
sum(consumed) as consumed,
sum(estimate) as estimate')
->from(TABLE_TASK)
->where('execution')->in($executionIdList)
->andWhere('deleted')->eq(0)
->andWhere('parent')->lt(1)
->groupBy('project')
$hours = $this->dao->select('t2.parent as project, sum(t1.consumed) as consumed, sum(t1.estimate) as estimate')->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
->where('t2.parent')->in($projectIdList)
->andWhere('t1.deleted')->eq(0)
->andWhere('t1.parent')->lt(1)
->groupBy('t2.parent')
->fetchAll('project');
$leftTasks = $this->dao->select('project, count(*) as tasks')->from(TABLE_TASK)
->where('execution')->in($executionIdList)
->andWhere('deleted')->eq(0)
->andWhere('status')->in('wait,doing,pause')
->groupBy('project')
$leftTasks = $this->dao->select('t2.parent as project, count(*) as tasks')->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
->where('t2.parent')->in($projectIdList)
->andWhere('t1.deleted')->eq(0)
->andWhere('t1.status')->in('wait,doing,pause')
->groupBy('t2.parent')
->fetchPairs();
$this->loadModel('product');
@@ -379,21 +374,18 @@ class projectModel extends model
ROUND(SUM(`left`), 2) AS totalLeft')
->from(TABLE_TASK)
->where('execution')->in(array_keys($executions))
->andWhere('project')->eq($projectID)
->andWhere('deleted')->eq(0)
->andWhere('parent')->lt(1)
->fetch();
$totalConsumed = $this->dao->select('ROUND(SUM(consumed), 1) AS totalConsumed')->from(TABLE_TASK)
->where('execution')->in(array_keys($executions))
->andWhere('project')->eq($projectID)
->andWhere('deleted')->eq(0)
->andWhere('parent')->lt(1)
->fetch('totalConsumed');
$closedTotalLeft = $this->dao->select('ROUND(SUM(`left`), 2) AS totalLeft')->from(TABLE_TASK)
->where('execution')->in(array_keys($executions))
->andWhere('project')->eq($projectID)
->andWhere('deleted')->eq(0)
->andWhere('parent')->lt(1)
->andWhere('status')->in('closed,cancel')