From 4de8fc462fdf8f776dc8dc7ac9ab4a463e6d6d60 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Mon, 6 Dec 2021 09:33:41 +0800 Subject: [PATCH] * Fix bug#17079. --- module/testtask/model.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module/testtask/model.php b/module/testtask/model.php index 74ba37814e..51243d6618 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -72,12 +72,11 @@ class testtaskModel extends model { $products = $scopeAndStatus[0] == 'all' ? $this->app->user->view->products : array(); - return $this->dao->select("t1.*, t2.name AS productName, t3.name AS executionName, t4.name AS buildName, if(t4.name != '', t4.branch, t5.branch) AS branch") + return $this->dao->select("t1.*, t2.name AS productName, t3.name AS executionName, t4.name AS buildName, t4.branch AS branch") ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->leftJoin(TABLE_EXECUTION)->alias('t3')->on('t1.execution = t3.id') ->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = t4.id') - ->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.execution = t5.project and t1.product = t5.product') ->where('t1.deleted')->eq(0) ->andWhere('t1.auto')->ne('unit') @@ -86,7 +85,7 @@ class testtaskModel extends model ->beginIF($scopeAndStatus[0] == 'all')->andWhere('t1.product')->in($products)->fi() ->beginIF(strtolower($scopeAndStatus[1]) == 'totalstatus')->andWhere('t1.status')->in('blocked,doing,wait,done')->fi() ->beginIF(strtolower($scopeAndStatus[1]) != 'totalstatus')->andWhere('t1.status')->eq($scopeAndStatus[1])->fi() - ->beginIF($branch !== 'all')->andWhere("if(t4.branch, t4.branch, t5.branch) = '$branch'")->fi() + ->beginIF($branch !== 'all')->andWhere('t4.branch')->eq($branch)->fi() ->beginIF($beginTime)->andWhere('t1.begin')->ge($beginTime)->fi() ->beginIF($endTime)->andWhere('t1.end')->le($endTime)->fi() ->orderBy($orderBy)