From b5127c2bb814112398a799889effe2ecc3a9dbdd Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 21 Mar 2023 13:14:54 +0800 Subject: [PATCH] * fix bug #33100. --- module/build/model.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/module/build/model.php b/module/build/model.php index 7dae5e405b..5f43f10e72 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -260,14 +260,13 @@ class buildModel extends model } $branchPairs = $this->dao->select('id,name')->from(TABLE_BRANCH)->fetchPairs(); - $shadows = $this->dao->select('shadow')->from(TABLE_RELEASE)->where('product')->in($products)->fetchPairs('shadow', 'shadow'); - $branchs = strpos($params, 'separate') === false ? "0,$branch" : $branch; - $allBuilds = $this->dao->select('t1.id, t1.name, t1.branch, t1.execution, t1.date, t1.deleted, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t5.type as productType')->from(TABLE_BUILD)->alias('t1') + $shadows = $this->dao->select('shadow')->from(TABLE_RELEASE)->where('product')->in($products)->fetchPairs('shadow', 'shadow'); + $branchs = strpos($params, 'separate') === false ? "0,$branch" : $branch; + $allBuilds = $this->dao->select('t1.id, t1.name, t1.branch, t1.execution, t1.date, t1.deleted, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.type as productType')->from(TABLE_BUILD)->alias('t1') ->beginIF($objectType === 'execution')->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')->fi() ->beginIF($objectType === 'project')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->fi() ->leftJoin(TABLE_RELEASE)->alias('t3')->on("FIND_IN_SET(t1.id,t3.build)") - ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') - ->leftJoin(TABLE_PRODUCT)->alias('t5')->on('t1.product = t5.id') + ->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t1.product = t4.id') ->where('1=1') ->andWhere('t1.id')->notIN($shadows) ->beginIF(strpos($params, 'hasdeleted') === false)->andWhere('t1.deleted')->eq(0)->fi() @@ -276,7 +275,6 @@ class buildModel extends model ->beginIF($products)->andWhere('t1.product')->in($products)->fi() ->beginIF($objectType === 'execution' and $objectID)->andWhere('t1.execution')->eq($objectID)->fi() ->beginIF($objectType === 'project' and $objectID)->andWhere('t1.project')->eq($objectID)->fi() - ->beginIF($branch !== 'all')->andWhere('t1.branch')->in("$branchs")->fi() ->orderBy('t1.date desc, t1.id desc')->fetchAll('id'); $deletedExecutions = $this->dao->select('id, deleted')->from(TABLE_EXECUTION)->where('type')->eq('sprint')->andWhere('deleted')->eq('1')->fetchPairs(); @@ -290,6 +288,7 @@ class buildModel extends model if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->objectStatus === 'done')) continue; if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue; if((strpos($params, 'withexecution') !== false) and $build->execution and isset($executions[$build->execution])) continue; + if($branch !== 'all' and strpos(",{$build->branch},", ",{$branch},")) continue; if($build->deleted == 1) $build->name .= ' (' . $this->lang->build->deleted . ')';