新增填空题

master
xiaoCJ
parent 938eb561be
commit 824c2762fe

@ -147,7 +147,7 @@ public class CompetitionExamBiz {
CompetitionTask task = competitionTaskDao.getByCompetitionIdAndStageId(vo.getCompId(), vo.getStageId());
Long costTime = now.getTime() - member.getExamStartTime().getTime();
if(costTime >3600000*task.getExamDuration()){
if (costTime > 3600000L * task.getExamDuration()) {
return Result.error("考试超时");
}
if (task.getExamEndTime().getTime() < now.getTime()) {
@ -169,16 +169,24 @@ public class CompetitionExamBiz {
//计算得分
private Double computeScore(List<QuestionVo> questionVoList, List<SubmitQuestionVO> submitQuestionVOS) {
Double totalScore = 0D;
for(int j = 0;j< submitQuestionVOS.size();j++)
{
for (int j = 0; j < submitQuestionVOS.size(); j++) {
SubmitQuestionVO submitQuestionVO = submitQuestionVOS.get(j);
QuestionVo q = questionVoList.stream().filter(questionVo -> questionVo.getId().equals(submitQuestionVO.getId())).findFirst().orElse(null);
if(q == null) { continue; }
if (q == null) {
continue;
}
if (q.getType() == 0) {
//普通题
if (checkCorrect(q.getAnswerId(), submitQuestionVO.getIds())) {
totalScore += q.getScore();
}
//填空题直接对比
if (q.getQuestionType() == 4) {
String title = q.getAnswerList().get(0).getTitle();
if (title.equals(submitQuestionVO.getGapFillingAnswer())) {
totalScore += q.getScore();
}
}
} else {
//案例题
SubQuestionVO subQuestionVO = q.getChildren().stream().filter(subQuestionVO1 -> subQuestionVO1.getId().intValue() == submitQuestionVO.getSubId()).findFirst().orElse(null);
@ -194,7 +202,9 @@ public class CompetitionExamBiz {
}
private boolean checkCorrect(List<Integer> answerId, List<Integer> checkList) {
if(checkList ==null||checkList.size() == 0) {return false;}
if (checkList == null || checkList.size() == 0) {
return false;
}
if (answerId.size() == checkList.size()) {
boolean correct = true;
for (int i = 0; i < checkList.size(); i++) {

@ -5,7 +5,8 @@ import java.util.List;
@Data
public class SubmitQuestionVO {
private Long id;
private Long id; //题目ID
private Integer subId;
private List<Integer> ids;
private List<Integer> ids; //答案ID
private String gapFillingAnswer;
}

@ -1,5 +0,0 @@
build.artifact=competition
build.group=com.tz
build.name=competition
build.time=2024-04-10T06\:30\:27.208Z
build.version=1.0-SNAPSHOT
Loading…
Cancel
Save