* Fix bug#15543.

This commit is contained in:
xieqiyu
2021-10-15 14:13:41 +08:00
parent 8e38b12360
commit 5697ba482a
2 changed files with 17 additions and 23 deletions
+5 -5
View File
@@ -1271,11 +1271,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');
}
+12 -18
View File
@@ -283,26 +283,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');