fix(测试跟踪): 测试计划关联UI后,进度问题

--bug=1020142 --user=张勇 【测试跟踪】测试计划关联UI后,状态会变成已结束 https://www.tapd.cn/55049933/s/1310940
This commit is contained in:
zhangyong 2022-12-02 13:41:04 +08:00 committed by zhangyongfit2cloud
parent baee39b50a
commit 7a23f52661
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,25 @@
package io.metersphere.constants;
public enum DataStatus {
UNEXECUTE("UnExecute", "未开始"),
UNDERWAY("Underway", "进行中"),
TRASH("Trash", "废弃"),
PREPARE("Prepare", "未开始"),
COMPLETED("Completed", "已完成");
private String value;
private String desc;
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
DataStatus(String value, String desc) {
this.value = value;
this.desc = desc;
}
}

View File

@ -12,6 +12,7 @@ import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.constants.DataStatus;
import io.metersphere.constants.RunModeConstants; import io.metersphere.constants.RunModeConstants;
import io.metersphere.dto.*; import io.metersphere.dto.*;
import io.metersphere.excel.constants.TestPlanTestCaseStatus; import io.metersphere.excel.constants.TestPlanTestCaseStatus;
@ -420,7 +421,7 @@ public class TestPlanService {
try { try {
List<String> execResults = getResultFunc.apply(planId); List<String> execResults = getResultFunc.apply(planId);
execResults.forEach(item -> { execResults.forEach(item -> {
if (StringUtils.isNotBlank(item) && !StringUtils.equalsIgnoreCase("UnExecute", item)) { if (StringUtils.isNotBlank(item) && !StringUtils.equalsIgnoreCase(DataStatus.UNEXECUTE.getValue(), item) && !StringUtils.equalsIgnoreCase(DataStatus.PREPARE.getValue(), item)) {
testPlan.setTested(testPlan.getTested() + 1); testPlan.setTested(testPlan.getTested() + 1);
if (StringUtils.equalsIgnoreCase(item, APITestStatus.Success.name())) { if (StringUtils.equalsIgnoreCase(item, APITestStatus.Success.name())) {
testPlan.setPassed(testPlan.getPassed() + 1); testPlan.setPassed(testPlan.getPassed() + 1);