From c90f09e650116fe7e00846b93ba7853af0522169 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 30 Jul 2025 11:39:21 +0800 Subject: [PATCH] * [refac bug #64295] Get case title from casespec table. --- module/testtask/model.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/module/testtask/model.php b/module/testtask/model.php index 9ca6686774..b60dee9f0e 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1000,9 +1000,10 @@ class testtaskModel extends model { $orderBy = $this->addPrefixToOrderBy($orderBy); - return $this->dao->select('t2.*, t1.*, t2.version as caseVersion, t3.title AS storyTitle, t2.status AS caseStatus')->from(TABLE_TESTRUN)->alias('t1') + return $this->dao->select('t2.*, t1.*, t2.version as caseVersion, t3.title AS storyTitle, t2.status AS caseStatus, IF(t4.title IS NULL, t2.title, t4.title) AS title')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') + ->leftJoin(TABLE_CASESPEC)->alias('t4')->on('t1.case = t4.case && t1.version = t4.version') ->where('t1.task')->eq($taskID) ->andWhere('t2.deleted')->eq('0') ->beginIF($modules)->andWhere('t2.module')->in($modules)->fi() @@ -1027,9 +1028,10 @@ class testtaskModel extends model $orderBy = $this->addPrefixToOrderBy($orderBy); $cases = $this->loadModel('testsuite')->getLinkedCasePairs($suiteID); - return $this->dao->select('t2.*,t1.*,t3.title as storyTitle,t2.status as caseStatus,t2.version as caseVersion')->from(TABLE_TESTRUN)->alias('t1') + return $this->dao->select('t2.*,t1.*,t3.title as storyTitle,t2.status as caseStatus,t2.version as caseVersion, IF(t4.title IS NULL, t2.title, t4.title) AS title')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') + ->leftJoin(TABLE_CASESPEC)->alias('t4')->on('t1.case = t4.case && t1.version = t4.version') ->where('t1.task')->eq($taskID) ->andWhere('t2.deleted')->eq('0') ->andWhere('t2.id')->in(array_keys($cases)) @@ -1076,9 +1078,10 @@ class testtaskModel extends model { $orderBy = $this->addPrefixToOrderBy($orderBy); - return $this->dao->select('t2.*, t1.*, t3.title AS storyTitle, t2.status AS caseStatus,t2.version AS caseVersion')->from(TABLE_TESTRUN)->alias('t1') + return $this->dao->select('t2.*, t1.*, t3.title AS storyTitle, t2.status AS caseStatus,t2.version AS caseVersion, IF(t4.title IS NULL, t2.title, t4.title) AS title')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') + ->leftJoin(TABLE_CASESPEC)->alias('t4')->on('t1.case = t4.case && t1.version = t4.version') ->where('t1.task')->eq($taskID) ->andWhere('t1.assignedTo')->eq($user) ->andWhere('t2.deleted')->eq('0') @@ -1187,9 +1190,10 @@ class testtaskModel extends model $caseQuery = str_replace(array('t2.`assignedTo`', 't2.`lastRunner`', 't2.`lastRunDate`', 't2.`lastRunResult`'), array('t1.`assignedTo`', 't1.`lastRunner`', 't1.`lastRunDate`', 't1.`lastRunResult`'), $caseQuery); $orderBy = $this->addPrefixToOrderBy($sort); - return $this->dao->select('t2.*, t1.*, t3.title AS storyTitle, t2.status AS caseStatus, t2.version AS caseVersion')->from(TABLE_TESTRUN)->alias('t1') + return $this->dao->select('t2.*, t1.*, t3.title AS storyTitle, t2.status AS caseStatus, t2.version AS caseVersion, IF(t4.title IS NULL, t2.title, t4.title) AS title')->from(TABLE_TESTRUN)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id') ->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id') + ->leftJoin(TABLE_CASESPEC)->alias('t4')->on('t1.case = t4.case && t1.version = t4.version') ->where($caseQuery) ->andWhere('t1.task')->eq($task->id) ->andWhere('t2.deleted')->eq('0')