From 943c46bda79e94e7c95fdc2cced8d7ea99e76439 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 4 May 2023 15:14:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8D=95=E6=93=8D=E6=89=93=E5=88=86?= =?UTF-8?q?=E8=A7=84=E5=88=99=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/services/training2/Training2Service.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/services/training2/Training2Service.java b/src/main/java/club/joylink/rtss/services/training2/Training2Service.java index 645187146..eeed00fae 100644 --- a/src/main/java/club/joylink/rtss/services/training2/Training2Service.java +++ b/src/main/java/club/joylink/rtss/services/training2/Training2Service.java @@ -283,8 +283,11 @@ public class Training2Service { return 0D; } List scoringRules = training2.getScoringRules(); - if (CollectionUtils.isEmpty(scoreDetailList) || CollectionUtils.isEmpty(scoringRules)) { + if (CollectionUtils.isEmpty(scoreDetailList)) { return 0D; + } else if (CollectionUtils.isEmpty(scoringRules)) { // 如果没有打分规则,直接取平均分 + long rightStepCount = scoreDetailList.stream().filter(PaperTrainAnswerDetail::isSuccess).count(); + return 100D * rightStepCount / scoreDetailList.size(); } else { List rightStepList = scoreDetailList.stream().filter(PaperTrainAnswerDetail::isSuccess) .map(PaperTrainAnswerDetail::getStepId).collect(Collectors.toList());