diff --git a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java index e79000abaf..9053d1f9ca 100644 --- a/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java +++ b/backend/services/dashboard/src/main/java/io/metersphere/dashboard/service/DashboardService.java @@ -1320,7 +1320,7 @@ public class DashboardService { List statusList = allSimpleList.stream().filter(t -> !localLastStepStatus.contains(t.getStatus())).toList(); int statusSize = CollectionUtils.isEmpty(statusList) ? 0 : statusList.size(); int totalSize = CollectionUtils.isEmpty(allSimpleList) ? 0 : allSimpleList.size(); - List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize); + List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize, false); Map> statusStatisticsMap = new HashMap<>(); statusStatisticsMap.put("retentionRate", nameCountDTOS); List headerStatusOption = getHeaderStatusOption(projectId, platformName, new ArrayList<>()); @@ -1350,7 +1350,7 @@ public class DashboardService { } - private static List buildBugRetentionRateList(int totalSize, int statusSize) { + private static List buildBugRetentionRateList(int totalSize, int statusSize, boolean isPlan) { List retentionRates = new ArrayList<>(); NameCountDTO retentionRate = new NameCountDTO(); retentionRate.setName(Translator.get("bug_management.retentionRate")); @@ -1361,10 +1361,18 @@ public class DashboardService { retentionRate.setCount(getTurnCount(divide)); } retentionRates.add(retentionRate); - NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount")); - retentionRates.add(retentionDTO); - NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount")); - retentionRates.add(total); + if (isPlan) { + NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount")); + retentionRates.add(retentionDTO); + NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount")); + retentionRates.add(total); + } else { + NameCountDTO total = getNameCountDTO(totalSize, Translator.get("bug_management.totalCount")); + retentionRates.add(total); + NameCountDTO retentionDTO = getNameCountDTO(statusSize, Translator.get("bug_management.retentionCount")); + retentionRates.add(retentionDTO); + } + return retentionRates; } @@ -1415,7 +1423,7 @@ public class DashboardService { List headerStatusOption = getHeaderStatusOption(projectId, platformName, localLastStepStatus); int statusSize = CollectionUtils.isEmpty(legacyBugList) ? 0 : legacyBugList.size(); int totalSize = CollectionUtils.isEmpty(planBugList) ? 0 : planBugList.size(); - List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize); + List nameCountDTOS = buildBugRetentionRateList(totalSize, statusSize, true); Map> statusStatisticsMap = new HashMap<>(); statusStatisticsMap.put("retentionRate", nameCountDTOS); Map> bugMap = legacyBugList.stream().collect(Collectors.groupingBy(SelectOption::getText));