From a37d7e3ae8afae4f0985a98493ed001d6dee20c6 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 5 Jul 2022 22:02:45 +0800 Subject: [PATCH] * Fix bug#23949. --- module/block/model.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/module/block/model.php b/module/block/model.php index ed9b2a1206..1c9b01f470 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -208,12 +208,17 @@ class blockModel extends model ->fetch('count'); $today = date('Y-m-d'); - $data['delayTask'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK) - ->where('assignedTo')->eq($this->app->user->account) - ->andWhere('status')->in('wait,doing') - ->andWhere('deadline')->ne('0000-00-00') - ->andWhere('deadline')->lt($today) - ->andWhere('deleted')->eq(0) + $data['delayTask'] = (int)$this->dao->select('count(t1.id) AS count')->from(TABLE_TASK)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on("t1.project = t2.id") + ->leftJoin(TABLE_EXECUTION)->alias('t3')->on("t1.execution = t3.id") + ->where('t1.assignedTo')->eq($this->app->user->account) + ->andWhere('(t2.status')->ne('suspended') + ->orWhere('t3.status')->ne('suspended') + ->markRight(1) + ->andWhere('t1.status')->in('wait,doing') + ->andWhere('t1.deadline')->ne('0000-00-00') + ->andWhere('t1.deadline')->lt($today) + ->andWhere('t1.deleted')->eq(0) ->fetch('count'); $data['delayBug'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG) ->where('assignedTo')->eq($this->app->user->account)