fix(测试计划): 修复无法正常显示已归档测试计划状态的问题
This commit is contained in:
parent
10ba0cc6c6
commit
5e2ef1d10a
|
@ -8,6 +8,7 @@ import io.metersphere.system.dto.request.schedule.BaseScheduleConfigRequest;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 测试计划统计详情
|
||||
|
@ -66,11 +67,13 @@ public class TestPlanStatisticsResponse {
|
|||
|
||||
/**
|
||||
* 计算测试计划状态
|
||||
* 非未归档的开始计算:
|
||||
* 未开始:执行进度0%
|
||||
* 进行中:执行进度不到100%
|
||||
* 已完成:执行进度100%
|
||||
*/
|
||||
public void calculateStatus() {
|
||||
if (!StringUtils.equalsIgnoreCase(this.status, TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED)) {
|
||||
if (this.successCount == 0 && errorCount == 0 && fakeErrorCount == 0 && blockCount == 0) {
|
||||
this.status = TestPlanConstants.TEST_PLAN_SHOW_STATUS_PREPARED;
|
||||
} else if (this.pendingCount == 0) {
|
||||
|
@ -79,6 +82,7 @@ public class TestPlanStatisticsResponse {
|
|||
this.status = TestPlanConstants.TEST_PLAN_SHOW_STATUS_UNDERWAY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateCaseTotal() {
|
||||
this.caseTotal = this.functionalCaseCount + this.apiCaseCount + this.apiScenarioCount;
|
||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.plan.mapper.*;
|
|||
import io.metersphere.sdk.constants.ExecStatus;
|
||||
import io.metersphere.sdk.constants.ResultStatus;
|
||||
import io.metersphere.sdk.constants.ScheduleResourceType;
|
||||
import io.metersphere.sdk.constants.TestPlanConstants;
|
||||
import io.metersphere.sdk.util.JSON;
|
||||
import io.metersphere.system.domain.Schedule;
|
||||
import io.metersphere.system.domain.ScheduleExample;
|
||||
|
@ -131,11 +132,15 @@ public class TestPlanStatisticsService {
|
|||
|
||||
groupTestPlanMap.forEach((rootPlan, children) -> {
|
||||
TestPlanStatisticsResponse rootResponse = this.genTestPlanStatisticsResponse(rootPlan, planConfigMap, planFunctionalCaseMap, planApiCaseMap, planApiScenarioMap, scheduleMap);
|
||||
rootResponse.setStatus(rootPlan.getStatus());
|
||||
|
||||
List<TestPlanStatisticsResponse> childrenResponse = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(children)) {
|
||||
List<String> childStatus = new ArrayList<>();
|
||||
children.forEach(child -> {
|
||||
TestPlanStatisticsResponse childResponse = this.genTestPlanStatisticsResponse(child, planConfigMap, planFunctionalCaseMap, planApiCaseMap, planApiScenarioMap, scheduleMap);
|
||||
childResponse.setStatus(child.getStatus());
|
||||
|
||||
childResponse.calculateStatus();
|
||||
childStatus.add(childResponse.getStatus());
|
||||
//添加到rootResponse中
|
||||
|
@ -145,7 +150,9 @@ public class TestPlanStatisticsService {
|
|||
rootResponse.calculateCaseTotal();
|
||||
rootResponse.calculatePassRate();
|
||||
rootResponse.calculateExecuteRate();
|
||||
if (!StringUtils.equalsIgnoreCase(rootResponse.getStatus(), TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED)) {
|
||||
rootResponse.setStatus(testPlanBaseUtilsService.calculateStatusByChildren(childStatus));
|
||||
}
|
||||
} else {
|
||||
rootResponse.calculateCaseTotal();
|
||||
rootResponse.calculatePassRate();
|
||||
|
|
Loading…
Reference in New Issue