[修改]场景实训结束后的评分展示中增加非用户角色的步骤(并增加每个步骤对应的角色id,非用户角色步骤没有分数)
All checks were successful
CI / Docker-Build (push) Successful in 6m56s

This commit is contained in:
thesai 2024-09-10 17:55:50 +08:00
parent 98abf0691a
commit 9c9e7c60e3
2 changed files with 48 additions and 42 deletions

View File

@ -16,8 +16,6 @@ import club.joylink.rtss.simulation.cbtc.GroupSimulationService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService; import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
import club.joylink.rtss.simulation.cbtc.SimulationService; import club.joylink.rtss.simulation.cbtc.SimulationService;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationGroup;
import club.joylink.rtss.simulation.cbtc.conversation.ConversationMember;
import club.joylink.rtss.simulation.cbtc.data.map.Switch; import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.simulation.cbtc.data.vo.ConversationMessageVO; import club.joylink.rtss.simulation.cbtc.data.vo.ConversationMessageVO;
import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO; import club.joylink.rtss.simulation.cbtc.data.vo.Training2MessageVO;
@ -317,7 +315,7 @@ 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())) // .filter(score -> Objects.equals(score.getMember().getId(), member.getId()))
.findFirst().ifPresent(scoringRule2 -> scoringRule2.getDetails() .findFirst().ifPresent(scoringRule2 -> scoringRule2.getDetails()
.forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore()))); .forEach(d -> scoreMap.put(d.getStep().getId(), d.getScore())));
} }
@ -327,11 +325,17 @@ public class Training2Service {
scoreDetailList.forEach(d -> answerDetailMap.put(d.getStepId(), d)); scoreDetailList.forEach(d -> answerDetailMap.put(d.getStepId(), d));
} }
return training2.getSteps().stream() return training2.getSteps().stream()
.filter(s -> Objects.equals(s.getSimulationMember().getId(), member.getId())) // .filter(s -> Objects.equals(s.getSimulationMember().getId(), member.getId()))
.map(step -> { .map(step -> {
PaperTrainAnswerDetail detail = new PaperTrainAnswerDetail(); PaperTrainAnswerDetail detail = new PaperTrainAnswerDetail();
detail.setMemberId(step.getSimulationMember().getId());
detail.setStepId(step.getId()); detail.setStepId(step.getId());
detail.setHaveRule(scoreMap.containsKey(step.getId())); detail.setHaveRule(scoreMap.containsKey(step.getId()));
detail.setRuleScore(scoreMap.get(step.getId()));
if (!Objects.equals(step.getSimulationMember().getId(), member.getId())) {
detail.setSuccess(true);
detail.setScore(detail.getRuleScore());
} 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.setScore(
@ -339,8 +343,6 @@ public class Training2Service {
detail.setClientOperations(answerDetailMap.get(step.getId()).getClientOperations()); detail.setClientOperations(answerDetailMap.get(step.getId()).getClientOperations());
detail.setNotExistAppend(true); detail.setNotExistAppend(true);
} }
if (detail.isHaveRule()) {
detail.setRuleScore(scoreMap.get(step.getId()));
} }
return detail; return detail;
}).collect(Collectors.toList()); }).collect(Collectors.toList());

View File

@ -1,11 +1,10 @@
package club.joylink.rtss.vo.paper; package club.joylink.rtss.vo.paper;
import club.joylink.rtss.vo.client.training2.Operation2VO; import club.joylink.rtss.vo.client.training2.Operation2VO;
import java.util.List;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
public class PaperTrainAnswerDetail { public class PaperTrainAnswerDetail {
@ -41,6 +40,11 @@ public class PaperTrainAnswerDetail {
*/ */
private List<TrainOperations> clientOperations; private List<TrainOperations> clientOperations;
/**
* 步骤对应的成员的id
*/
private String memberId;
public static class TrainOperations extends Operation2VO.ClientOperation2VO { public static class TrainOperations extends Operation2VO.ClientOperation2VO {