[bug]实训中,有多个评分规则时,仅有一个评分规则被使用
All checks were successful
CI / Docker-Build (push) Successful in 2m12s

This commit is contained in:
thesai 2024-09-18 10:37:33 +08:00
parent 3536ff75ad
commit ac87b0dbe9

View File

@ -315,9 +315,12 @@ public class Training2Service {
Map<Long, Float> scoreMap = new HashMap<>(); Map<Long, Float> scoreMap = new HashMap<>();
if (!CollectionUtils.isEmpty(training2.getScoringRules())) { if (!CollectionUtils.isEmpty(training2.getScoringRules())) {
training2.getScoringRules().stream() training2.getScoringRules().stream()
// .filter(score -> Objects.equals(score.getMember().getId(), member.getId())) .flatMap(sr -> sr.getDetails().stream())
.findFirst().ifPresent(scoringRule2 -> scoringRule2.getDetails() .forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore()));
.forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore()))); // training2.getScoringRules().stream()
//// .filter(score -> Objects.equals(score.getMember().getId(), member.getId()))
// .findFirst().ifPresent(scoringRule2 -> scoringRule2.getDetails()
// .forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore())));
} }
// 前端传回的步骤信息 // 前端传回的步骤信息
Map<Long, PaperTrainAnswerDetail> answerDetailMap = new HashMap<>(); Map<Long, PaperTrainAnswerDetail> answerDetailMap = new HashMap<>();
@ -337,11 +340,11 @@ public class Training2Service {
} else { } else {
if (answerDetailMap.containsKey(step.getId())) { if (answerDetailMap.containsKey(step.getId())) {
detail.setSuccess(answerDetailMap.get(step.getId()).isSuccess()); detail.setSuccess(answerDetailMap.get(step.getId()).isSuccess());
detail.setScore(
detail.isHaveRule() && detail.isSuccess() ? scoreMap.get(step.getId()) : 0F);
detail.setClientOperations(answerDetailMap.get(step.getId()).getClientOperations()); detail.setClientOperations(answerDetailMap.get(step.getId()).getClientOperations());
detail.setNotExistAppend(true); detail.setNotExistAppend(true);
} }
detail.setScore(
detail.isHaveRule() && detail.isSuccess() ? scoreMap.get(step.getId()) : 0F);
} }
return detail; return detail;
}).collect(Collectors.toList()); }).collect(Collectors.toList());