修改实训演练得分

master
xiaoCJ 8 months ago
parent cf9b8066e3
commit a8378ede5d

@ -19,7 +19,6 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*; import java.util.*;
/** /**
@ -125,7 +124,7 @@ public class ObjectiveQuestionServiceImpl implements ObjectiveQuestionService {
stuTrainingExample.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId); stuTrainingExample.createCriteria().andUserIdEqualTo(userId).andChapterIdEqualTo(chapterId);
List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = stuTrainingMapper.selectByExampleWithBLOBs(stuTrainingExample); List<StuTrainingWithBLOBs> stuTrainingWithBLOBs = stuTrainingMapper.selectByExampleWithBLOBs(stuTrainingExample);
BigDecimal score = new BigDecimal(BigInteger.ZERO); // BigDecimal score = new BigDecimal(BigInteger.ZERO);
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
List<String> answerList = new ArrayList<>(); List<String> answerList = new ArrayList<>();
int count = 0; int count = 0;
@ -134,9 +133,7 @@ public class ObjectiveQuestionServiceImpl implements ObjectiveQuestionService {
ObjectiveQuestionWithBLOBs dataObjectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(dtoObjectiveId); ObjectiveQuestionWithBLOBs dataObjectiveQuestion = objectiveQuestionMapper.selectByPrimaryKey(dtoObjectiveId);
String rightAnswer = dataObjectiveQuestion.getAnswer(); String rightAnswer = dataObjectiveQuestion.getAnswer();
String stuAnswer = objectiveQuestionDto.getUserAnswer(); String stuAnswer = objectiveQuestionDto.getUserAnswer();
if (rightAnswer.equals(stuAnswer)) { if (!rightAnswer.equals(stuAnswer)) {
score = score.add(dataObjectiveQuestion.getScore());
} else {
count += 1; count += 1;
} }
ids.add(dtoObjectiveId); ids.add(dtoObjectiveId);
@ -151,7 +148,6 @@ public class ObjectiveQuestionServiceImpl implements ObjectiveQuestionService {
dataTraining.setLearningEvalAnswer(String.valueOf(answerList)); dataTraining.setLearningEvalAnswer(String.valueOf(answerList));
dataTraining.setLearningEvalIdList(String.valueOf(ids)); dataTraining.setLearningEvalIdList(String.valueOf(ids));
dataTraining.setExpTrainingScore(score);
dataTraining.setLearningEvalCompleteStatus(count); dataTraining.setLearningEvalCompleteStatus(count);
stuTrainingMapper.updateByPrimaryKeySelective(dataTraining); stuTrainingMapper.updateByPrimaryKeySelective(dataTraining);
} }

Loading…
Cancel
Save