fix(工作台): 修复计划遗留卡片展示问题

This commit is contained in:
guoyuqi 2024-11-25 16:16:10 +08:00 committed by 刘瑞斌
parent 84f26fc593
commit d5470a8f15
2 changed files with 9 additions and 7 deletions

View File

@ -1323,7 +1323,7 @@ public class DashboardService {
List<NameCountDTO> nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize); List<NameCountDTO> nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize);
Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>(); Map<String, List<NameCountDTO>> statusStatisticsMap = new HashMap<>();
statusStatisticsMap.put("retentionRate", nameCountDTOS); statusStatisticsMap.put("retentionRate", nameCountDTOS);
List<SelectOption> headerStatusOption = getHeaderStatusOption(projectId, platformName); List<SelectOption> headerStatusOption = getHeaderStatusOption(projectId, platformName, new ArrayList<>());
Map<String, List<Bug>> bugMap = allSimpleList.stream().collect(Collectors.groupingBy(Bug::getStatus)); Map<String, List<Bug>> bugMap = allSimpleList.stream().collect(Collectors.groupingBy(Bug::getStatus));
List<StatusPercentDTO> bugPercentList = bulidBugPercentList(headerStatusOption, bugMap, totalSize); List<StatusPercentDTO> bugPercentList = bulidBugPercentList(headerStatusOption, bugMap, totalSize);
statisticsDTO.setStatusStatisticsMap(statusStatisticsMap); statisticsDTO.setStatusStatisticsMap(statusStatisticsMap);
@ -1361,10 +1361,10 @@ public class DashboardService {
retentionRate.setCount(getTurnCount(divide)); retentionRate.setCount(getTurnCount(divide));
} }
retentionRates.add(retentionRate); retentionRates.add(retentionRate);
NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount"));
retentionRates.add(total);
NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount")); NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount"));
retentionRates.add(retentionDTO); retentionRates.add(retentionDTO);
NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount"));
retentionRates.add(total);
return retentionRates; return retentionRates;
} }
@ -1412,7 +1412,7 @@ public class DashboardService {
List<SelectOption> planBugList = extTestPlanMapper.getPlanBugList(projectId, TestPlanConstants.TEST_PLAN_TYPE_PLAN, new ArrayList<>(platforms), null); List<SelectOption> planBugList = extTestPlanMapper.getPlanBugList(projectId, TestPlanConstants.TEST_PLAN_TYPE_PLAN, new ArrayList<>(platforms), null);
List<String> localLastStepStatus = getBugEndStatus(projectId, platformName); List<String> localLastStepStatus = getBugEndStatus(projectId, platformName);
List<SelectOption> legacyBugList = planBugList.stream().filter(t -> !localLastStepStatus.contains(t.getText())).toList(); List<SelectOption> legacyBugList = planBugList.stream().filter(t -> !localLastStepStatus.contains(t.getText())).toList();
List<SelectOption> headerStatusOption = getHeaderStatusOption(projectId, platformName); List<SelectOption> headerStatusOption = getHeaderStatusOption(projectId, platformName, localLastStepStatus);
int statusSize = CollectionUtils.isEmpty(legacyBugList) ? 0 : legacyBugList.size(); int statusSize = CollectionUtils.isEmpty(legacyBugList) ? 0 : legacyBugList.size();
int totalSize = CollectionUtils.isEmpty(planBugList) ? 0 : planBugList.size(); int totalSize = CollectionUtils.isEmpty(planBugList) ? 0 : planBugList.size();
List<NameCountDTO> nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize); List<NameCountDTO> nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize);
@ -1441,7 +1441,7 @@ public class DashboardService {
} }
@NotNull @NotNull
private List<SelectOption> getHeaderStatusOption(String projectId, String platformName) { private List<SelectOption> getHeaderStatusOption(String projectId, String platformName, List<String> endStatus) {
List<SelectOption> allLocalStatusOptions = bugStatusService.getAllLocalStatusOptions(projectId); List<SelectOption> allLocalStatusOptions = bugStatusService.getAllLocalStatusOptions(projectId);
List<SelectOption> headerStatusOption = new ArrayList<>(allLocalStatusOptions); List<SelectOption> headerStatusOption = new ArrayList<>(allLocalStatusOptions);
if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) { if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) {
@ -1450,7 +1450,7 @@ public class DashboardService {
headerStatusOption.addAll(thirdStatusOptions); headerStatusOption.addAll(thirdStatusOptions);
} }
} }
headerStatusOption = headerStatusOption.stream().distinct().toList(); headerStatusOption = headerStatusOption.stream().filter(t->!endStatus.contains(t.getValue())).distinct().toList();
return headerStatusOption; return headerStatusOption;
} }

View File

@ -135,7 +135,9 @@
hasPermission.value = errorCode !== 109001; hasPermission.value = errorCode !== 109001;
countOptions.value = handlePieData(props.item.key, hasPermission.value, statusPercentList); countOptions.value = handlePieData(props.item.key, hasPermission.value, statusPercentList);
if (props.item.key === WorkCardEnum.PLAN_LEGACY_BUG) {
countOptions.value.title.text = t('workbench.homePage.legacyDefectsNumber');
}
const [rate, totalBug, legacy] = statusStatisticsMap?.retentionRate || []; const [rate, totalBug, legacy] = statusStatisticsMap?.retentionRate || [];
const unLegacy = totalBug && legacy ? totalBug.count - legacy.count : 0; const unLegacy = totalBug && legacy ? totalBug.count - legacy.count : 0;