From e3ea0186b44bb78eeeb6d702025682b020886ccc Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 26 Jul 2022 15:55:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=89=E6=9C=AA=E6=89=A7=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=AD=A5=E9=AA=A4=E7=BB=9F=E8=AE=A1=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015368 --user=王孝刚 【接口测试】有未执行步骤时,场景报告统计的请求数量不对 https://www.tapd.cn/55049933/s/1212160 --- .../service/ApiScenarioReportStructureService.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java index 12c9fd3dfa..402b3b11ba 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java @@ -412,8 +412,10 @@ public class ApiScenarioReportStructureService { List list = dtoList.stream().filter(e -> e.getValue() != null && e.getValue().getStartTime() != 0).collect(Collectors.toList()); list = list.stream().sorted(Comparator.comparing(x -> x.getValue().getStartTime())).collect(Collectors.toList()); unList = unList.stream().sorted(Comparator.comparing(x -> x.getIndex())).collect(Collectors.toList()); + unList.addAll(steps); + List mergeList = unList.stream().distinct().collect(Collectors.toList()); // 处理请求结果开始时间为0的数据 - for (StepTreeDTO unListDTO : unList) { + for (StepTreeDTO unListDTO : mergeList) { int index = unListDTO.getIndex(); if (index > 0) { list.add(index - 1, unListDTO); @@ -422,13 +424,6 @@ public class ApiScenarioReportStructureService { for (int index = 0; index < list.size(); index++) { list.get(index).setIndex((index + 1)); } - // 处理步骤为空的数据 - for (StepTreeDTO step : steps) { - int index = step.getIndex(); - if (index > 0) { - list.add(index - 1, step); - } - } dtoList.clear(); dtoList.addAll(list); } catch (Exception e) {