修改实训演练得分

master
xiaoCJ 7 months ago
parent cf9b8066e3
commit a8378ede5d

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

Loading…
Cancel
Save