fix(测试跟踪): 新建功能用例等级字段为非必填时报错

--bug=1011509 --user=李玉号
[测试跟踪]github#11698新建功能用例,用例等级字段为非必填时,无法把用例新增到最新版本以外的其他版本中。
https://www.tapd.cn/55049933/s/1123065

Closes #11698
This commit is contained in:
shiziyuan9527 2022-03-22 14:04:29 +08:00 committed by 刘瑞斌
parent c68cac36ae
commit b071d4c21a
2 changed files with 22 additions and 17 deletions

View File

@ -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<TrackCountResult> 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();
}

View File

@ -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());