diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java index 2ba9c238ed..2b9c513797 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanReportService.java @@ -472,7 +472,7 @@ public class TestPlanReportService { TestPlanService testPlanService = CommonBeanFactory.getBean(TestPlanService.class); TestPlanSimpleReportDTO reportDTO = testPlanService.buildPlanReport(testPlanReport, reportContent); reportDTO.setStartTime(testPlanReport.getStartTime()); - reportContent = parseReportDaoToReportContent(reportDTO, reportContent); + reportContent = parseReportDaoToReportContent(testPlanReport.getStatus(), reportDTO, reportContent); return reportContent; } @@ -598,7 +598,7 @@ public class TestPlanReportService { TestPlanSimpleReportDTO reportDTO = testPlanService.buildPlanReport(testPlan.getId(), false); if (!testPlanReportContentList.isEmpty()) { testPlanReportContent = testPlanReportContentList.get(0); - testPlanReportContentMapper.updateByPrimaryKeySelective(parseReportDaoToReportContent(reportDTO, testPlanReportContent)); + testPlanReportContentMapper.updateByPrimaryKeySelective(parseReportDaoToReportContent(testPlanReport.getStatus(), reportDTO, testPlanReportContent)); } if (reportDTO.getStartTime() == null) { @@ -615,7 +615,7 @@ public class TestPlanReportService { testPlanMessageService.checkTestPlanStatusAndSendMessage(testPlanReport, null, false); } - public TestPlanReportContentWithBLOBs parseReportDaoToReportContent(TestPlanSimpleReportDTO reportDTO, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs) { + public TestPlanReportContentWithBLOBs parseReportDaoToReportContent(String testPlanReportStatus, TestPlanSimpleReportDTO reportDTO, TestPlanReportContentWithBLOBs testPlanReportContentWithBLOBs) { String id = testPlanReportContentWithBLOBs.getId(); String testPlanReportId = testPlanReportContentWithBLOBs.getTestPlanReportId(); if (testPlanReportContentWithBLOBs.getEndTime() != null) { @@ -673,13 +673,14 @@ public class TestPlanReportService { testPlanReportContentWithBLOBs.setUnExecuteScenarios(JSONObject.toJSONString(reportDTO.getUnExecuteScenarios())); } - // 更新测试计划报告通过率字段 passRate - TestPlanReportContentExample contentExample = new TestPlanReportContentExample(); - contentExample.createCriteria().andTestPlanReportIdEqualTo(testPlanReportId); - TestPlanReportContentWithBLOBs content = new TestPlanReportContentWithBLOBs(); - content.setPassRate(reportDTO.getPassRate()); - testPlanReportContentMapper.updateByExampleSelective(content, contentExample); - + // 如果报告已结束,则更新测试计划报告通过率字段 passRate + if (!StringUtils.equalsIgnoreCase(testPlanReportStatus, "running")) { + TestPlanReportContentExample contentExample = new TestPlanReportContentExample(); + contentExample.createCriteria().andTestPlanReportIdEqualTo(testPlanReportId); + TestPlanReportContentWithBLOBs content = new TestPlanReportContentWithBLOBs(); + content.setPassRate(reportDTO.getPassRate()); + testPlanReportContentMapper.updateByExampleSelective(content, contentExample); + } return testPlanReportContentWithBLOBs; } diff --git a/frontend/src/business/components/reportstatistics/projectstatistics/ProjectStatistics.vue b/frontend/src/business/components/reportstatistics/projectstatistics/ProjectStatistics.vue index 2443cf65ca..5e74593ae3 100644 --- a/frontend/src/business/components/reportstatistics/projectstatistics/ProjectStatistics.vue +++ b/frontend/src/business/components/reportstatistics/projectstatistics/ProjectStatistics.vue @@ -93,6 +93,8 @@ export default { }, methods: { openCard(type) { + this.historyReportName = ""; + this.historyReportId = ""; if (type === 'trackTestCase') { this.testCaseTrendDrawer = true; } else if (type === 'countTestCase') { @@ -100,6 +102,8 @@ export default { } }, close() { + this.historyReportName = ""; + this.historyReportId = ""; this.testCaseTrendDrawer = false; this.testCaseCountDrawer = false; },