diff --git a/backend/src/main/java/io/metersphere/track/response/TrackStatisticsDTO.java b/backend/src/main/java/io/metersphere/track/response/TrackStatisticsDTO.java index 4749cf47e2..9319ef0caf 100644 --- a/backend/src/main/java/io/metersphere/track/response/TrackStatisticsDTO.java +++ b/backend/src/main/java/io/metersphere/track/response/TrackStatisticsDTO.java @@ -5,6 +5,7 @@ import io.metersphere.commons.constants.TestReviewCaseStatus; import io.metersphere.track.request.testcase.TrackCount; import lombok.Getter; import lombok.Setter; +import org.apache.commons.lang3.StringUtils; import java.util.List; @@ -110,21 +111,23 @@ public class TrackStatisticsDTO { */ public void countPriority(List trackCountResults) { for (TrackCountResult countResult : trackCountResults) { - switch (countResult.getGroupField().toUpperCase()){ - case TrackCount.P0: - this.p0CaseCountNumber += countResult.getCountNumber(); - break; - case TrackCount.P1: - this.p1CaseCountNumber += countResult.getCountNumber(); - break; - case TrackCount.P2: - this.p2CaseCountNumber += countResult.getCountNumber(); - break; - case TrackCount.P3: - this.p3CaseCountNumber += countResult.getCountNumber(); - break; - default: - break; + if (StringUtils.isNotBlank(countResult.getGroupField())) { + switch (countResult.getGroupField().toUpperCase()){ + case TrackCount.P0: + this.p0CaseCountNumber += countResult.getCountNumber(); + break; + case TrackCount.P1: + this.p1CaseCountNumber += countResult.getCountNumber(); + break; + case TrackCount.P2: + this.p2CaseCountNumber += countResult.getCountNumber(); + break; + case TrackCount.P3: + this.p3CaseCountNumber += countResult.getCountNumber(); + break; + default: + break; + } } this.allCaseCountNumber += countResult.getCountNumber(); } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index d4470c1373..872d6499bb 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -424,8 +424,10 @@ public class TestCaseService { criteria.andNameEqualTo(testCase.getName()) .andProjectIdEqualTo(testCase.getProjectId()) .andNodePathEqualTo(nodePath) - .andTypeEqualTo(testCase.getType()) - .andPriorityEqualTo(testCase.getPriority()); + .andTypeEqualTo(testCase.getType()); + if (StringUtils.isNotBlank(testCase.getPriority())) { + criteria.andPriorityEqualTo(testCase.getPriority()); + } if (StringUtils.isNotBlank(testCase.getTestId())) { criteria.andTestIdEqualTo(testCase.getTestId());