瀏覽代碼

针对套题中非主观题的场景代码优化

lideyin 5 年之前
父節點
當前提交
0faf2100c0

+ 15 - 0
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamRecordCloudServiceProvider.java

@@ -353,6 +353,11 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
 
                     //其次,拼装套题的其它几个小题的题干(只初始化题干和唯一标识),并提前添加到结果集中
                     for (int j = 1; j < questionUnits.size(); j++) {
+                        //判断当前套题中的小题是否为主观题,只有主观题才需要添加进来
+                        if (!isSubjectiveQuestion(questionUnits.get(j).getQuestionType())) {
+                            continue;
+                        }
+
                         ToBeMarkSubjectiveAnswerBean nextSubjectiveAnswerBean = new ToBeMarkSubjectiveAnswerBean();
                         nextSubjectiveAnswerBean.setQuestionId(questionId);
                         nextSubjectiveAnswerBean.setOrder(order + j);
@@ -373,6 +378,16 @@ public class ExamRecordCloudServiceProvider extends ControllerSupport implements
         return subjectiveAnswerBeanList;
     }
 
+    /**
+     * 当前题型是否为主观题
+     *
+     * @param questionType
+     * @return
+     */
+    private boolean isSubjectiveQuestion(QuestionType questionType) {
+        return (QuestionType.ESSAY == questionType || QuestionType.FILL_UP == questionType);
+    }
+
     /**
      * 根据原始作答类型和学生实际作答推断出真实的作答类型
      *