From cca08c5c0b41f01985ea1dc58cbffefadaf3c35c Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 25 Sep 2023 09:55:41 +0800 Subject: [PATCH] * testtask: rename the processRowspanOfCases method to processRowspanForGroupCase and refactor it. --- module/testtask/control.php | 3 ++- module/testtask/zen.php | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/module/testtask/control.php b/module/testtask/control.php index 0593af7ec6..bd60eba7d3 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -480,10 +480,11 @@ class testtask extends control $groupBy = $groupBy ?: 'story'; $cases = $this->testtask->getRuns($taskID, 0, $groupBy); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); + $cases = $this->loadModel('testcase')->appendData($cases, 'run'); /* 处理测试用例的跨行合并属性供前端组件分组使用。*/ /* Process the rowspan property of cases for use by front-end component groupings. */ - $cases = $this->testtaskZen->processRowspanOfCases($cases, $task->build); + $cases = $this->testtaskZen->processRowspanForGroupCase($cases, $task->build); $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; $this->view->users = $this->loadModel('user')->getPairs('noletter'); diff --git a/module/testtask/zen.php b/module/testtask/zen.php index 0d08a9fe4a..1bd3c3f364 100644 --- a/module/testtask/zen.php +++ b/module/testtask/zen.php @@ -520,18 +520,17 @@ class testtaskZen extends testtask } /** - * 处理测试用例的跨行合并属性供前端组件分组使用。 - * Process the rowspan property of cases for use by front-end component groupings. + * 处理分组查看页面的测试用例的跨行合并属性供前端组件分组使用。 + * Process the rowspan property of cases for groupCase page for use by front-end component groupings. * * @param array $cases * @param int $build * @access protected * @return array */ - protected function processRowspanOfCases(array $cases, int $build): array + protected function processRowspanForGroupCase(array $cases, int $build): array { $groupCases = array(); - $cases = $this->loadModel('testcase')->appendData($cases, 'run'); foreach($cases as $case) $groupCases[$case->story][] = $case; if($build) @@ -545,14 +544,16 @@ class testtaskZen extends testtask } } + /* 将每个需求的总用例数量赋予每个需求的第一条测试用例。*/ + /* Assign the total number of test cases under each story to the first test case of each story. */ $story = null; foreach($cases as $case) { $case->rowspan = 0; - if($story !== $case->story) + if($story !== $case->story && !empty($groupCases[$case->story])) { $story = $case->story; - if(!empty($groupCases[$case->story])) $case->rowspan = count($groupCases[$case->story]); + $case->rowspan = count($groupCases[$case->story]); } }