refactor(测试跟踪): 修复只有功能用例的测试计划报告展开报错的问题

--bug=1011486 --user=宋天阳 【测试计划】只存在功能用例 报告统计 页面报错
https://www.tapd.cn/55049933/s/1122433
This commit is contained in:
song-tianyang 2022-03-21 18:33:12 +08:00 committed by CountryBuilder
parent 89f89ae81e
commit 9ddcb35344
2 changed files with 18 additions and 13 deletions

View File

@ -412,17 +412,22 @@ public class TestPlanTestCaseService {
}
public List<TestPlanCaseDTO> buildCaseInfo(List<TestPlanCaseDTO> cases) {
Map<String, Project> projectMap = ServiceUtils.getProjectMap(
cases.stream().map(TestPlanCaseDTO::getProjectId).collect(Collectors.toList()));
Map<String, String> userNameMap = ServiceUtils.getUserNameMap(
cases.stream().map(TestPlanCaseDTO::getExecutor).collect(Collectors.toList()));
cases.forEach(item -> {
item.setProjectName(projectMap.get(item.getProjectId()).getName());
ProjectConfig config = projectApplicationService.getSpecificTypeValue(item.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
boolean customNum = config.getCaseCustomNum();
item.setIsCustomNum(customNum);
item.setExecutorName(userNameMap.get(item.getExecutor()));
});
if(CollectionUtils.isNotEmpty(cases)){
Map<String, Project> projectMap = ServiceUtils.getProjectMap(
cases.stream().map(TestPlanCaseDTO::getProjectId).collect(Collectors.toList()));
Map<String, String> userNameMap = ServiceUtils.getUserNameMap(
cases.stream().map(TestPlanCaseDTO::getExecutor).collect(Collectors.toList()));
cases.forEach(item -> {
if(projectMap.containsKey(item.getProjectId())){
item.setProjectName(projectMap.get(item.getProjectId()).getName());
}
ProjectConfig config = projectApplicationService.getSpecificTypeValue(item.getProjectId(), ProjectApplicationType.CASE_CUSTOM_NUM.name());
boolean customNum = config.getCaseCustomNum();
item.setIsCustomNum(customNum);
item.setExecutorName(userNameMap.get(item.getExecutor()));
});
}
return cases;
}

View File

@ -24,14 +24,14 @@
</el-tab-pane>
<el-tab-pane name="errorReport" v-if="content.errorCode > 0">
<template slot="label">
<span class="fail">{{ $t('error_report_library.option.name') }}</span>
<span class="fail" style="color: #F6972A">{{ $t('error_report_library.option.name') }}</span>
</template>
<ms-scenario-results v-on:requestResult="requestResult" :console="content.console"
:treeData="fullTreeNodes" ref="errorReportTree"/>
</el-tab-pane>
<el-tab-pane name="unExecute" v-if="content.unExecute > 0">
<template slot="label">
<span class="fail">{{ $t('api_test.home_page.detail_card.unexecute') }}</span>
<span class="fail" style="color: #9C9B9A">{{ $t('api_test.home_page.detail_card.unexecute') }}</span>
</template>
<ms-scenario-results v-on:requestResult="requestResult" :console="content.console"
:treeData="fullTreeNodes" ref="unExecuteTree"/>