From 6db1eac73fa5e16c43bdcf302cc1fe9c39ecb34b Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 Aug 2022 11:07:47 +0800 Subject: [PATCH] * Finish task #66938. --- module/project/model.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index 0c54d66c37..0327e845cd 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -219,9 +219,11 @@ class projectModel extends model if(empty($projects)) return array(); $projectIdList = array_keys($projects); - $teams = $this->dao->select('root, count(*) as count')->from(TABLE_TEAM) - ->where('root')->in($projectIdList) - ->groupBy('root') + $teams = $this->dao->select('t1.root, count(t1.id) as count')->from(TABLE_TEAM)->alias('t1') + ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account') + ->where('t1.root')->in($projectIdList) + ->andWhere('t2.deleted')->eq(0) + ->groupBy('t1.root') ->fetchAll('root'); $condition = $this->config->systemMode == 'classic' ? 't2.id as project' : 't2.parent as project'; @@ -298,9 +300,11 @@ class projectModel extends model if(empty($projects)) return array(); $projectIdList = array_keys($projects); - $teams = $this->dao->select('root, count(*) as teams')->from(TABLE_TEAM) - ->where('root')->in($projectIdList) - ->andWhere('type')->eq('project') + $teams = $this->dao->select('t1.root, count(t1.id) as teams')->from(TABLE_TEAM)->alias('t1') + ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account') + ->where('t1.root')->in($projectIdList) + ->andWhere('t1.type')->eq('project') + ->andWhere('t2.deleted')->eq(0) ->groupBy('root')->fetchPairs(); $hours = $this->dao->select('t2.parent as project, ROUND(SUM(t1.consumed), 1) AS consumed, ROUND(SUM(t1.estimate), 1) AS estimate')->from(TABLE_TASK)->alias('t1')