Explorar el Código

Merge branch 'iterator5'

ChenSiTong hace 6 años
padre
commit
bc0e440dd5

+ 10 - 4
src/main/java/nju/seec/helper/service/impl/QuestionServiceImpl.java

@@ -217,10 +217,14 @@ public class QuestionServiceImpl implements QuestionService {
         if (studentAnswerDTO.getRecords() == null || studentAnswerDTO.getRecords().isEmpty()) {
             return;
         }
-        // 获取已有信息
-        String userId = String.valueOf(user.getPid());
-
-        Map<String, StudentAnswerDTO.AnswerRecordDTO> recordMap = studentAnswerDTO.getRecords();
+        Map<String, StudentAnswerDTO.AnswerRecordDTO> recordMap = studentAnswerDTO.getRecords()
+                .entrySet()
+                .stream()
+                .filter(entry -> entry.getValue().getStartAt().isBefore(entry.getValue().getEndAt()))
+                .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+        if (recordMap.isEmpty()) {
+            return;
+        }
         List<BaseQuestionVO> baseQuestionVOList = questionQueryApi.getQuestionListById(Lists.newArrayList(recordMap.keySet()))
                 .stream()
                 .map(questionVO -> BaseQuestionVO.convertBokQuestionToVO(questionVO, true))
@@ -232,6 +236,8 @@ public class QuestionServiceImpl implements QuestionService {
         List<RecordDTO> records = Lists.newArrayListWithExpectedSize(size);
 
         // 填充列表
+        String userId = String.valueOf(user.getPid());
+
         baseQuestionVOList.forEach(baseQuestionVO -> {
             String questionId = baseQuestionVO.getId();
             StudentAnswerDTO.AnswerRecordDTO answerRecord = recordMap.get(questionId);

+ 1 - 1
src/main/java/nju/seec/helper/sys/dataanalysis/api/ExerciseApi.java

@@ -33,7 +33,7 @@ public class ExerciseApi {
                 .questionId(questionId)
                 .startAt(startAt)
                 .endAt(endAt)
-                .durationSeconds(Duration.between(startAt, endAt).getSeconds())
+                .durationSeconds(Duration.between(startAt, endAt).getSeconds() + 1)
                 .pass(pass)
                 .build();
     }