Kaynağa Gözat

fix: 【仲裁管理】选做题仲裁时设置试题为未选做失败

chenhao 2 yıl önce
ebeveyn
işleme
1f24cddf8e
1 değiştirilmiş dosya ile 30 ekleme ve 30 silme
  1. 30 30
      src/features/arbitrate/Arbitrate.vue

+ 30 - 30
src/features/arbitrate/Arbitrate.vue

@@ -165,36 +165,6 @@ const saveTaskToServer = async (unselective: boolean) => {
   console.log("save inspect task to server");
   const mkey = "save_task_key";
   void message.loading({ content: "保存评卷任务...", key: mkey });
-  type SubmitError = {
-    question: Question;
-    index: number;
-    error: string;
-  };
-  const errors: SubmitError[] = [];
-  markResult.scoreList.forEach((score, index) => {
-    if (!store.currentTask) return;
-    const question = store.currentTask.questionList[index];
-    let error;
-    if (!isNumber(score)) {
-      error = `${question.mainNumber}-${question.subNumber} 没有赋分不能提交。`;
-    } else if (isNumber(question.maxScore) && score > question.maxScore) {
-      error = `${question.mainNumber}-${question.subNumber} 赋分大于最高分不能提交。`;
-    } else if (isNumber(question.minScore) && score < question.minScore) {
-      error = `${question.mainNumber}-${question.subNumber} 赋分小于最低分不能提交。`;
-    }
-    if (error) {
-      errors.push({ question, index, error });
-    }
-  });
-  if (errors.length) {
-    console.log(errors);
-    const msg = errors.map((v) => h("div", `${v.error}`));
-    return message.warning({
-      content: h("span", ["校验失败", ...msg]),
-      duration: 10,
-      key: mkey,
-    });
-  }
   let res;
   if (unselective) {
     res = await saveArbitrateTask(
@@ -205,6 +175,36 @@ const saveTaskToServer = async (unselective: boolean) => {
       true
     );
   } else {
+    type SubmitError = {
+      question: Question;
+      index: number;
+      error: string;
+    };
+    const errors: SubmitError[] = [];
+    markResult.scoreList.forEach((score, index) => {
+      if (!store.currentTask) return;
+      const question = store.currentTask.questionList[index];
+      let error;
+      if (!isNumber(score)) {
+        error = `${question.mainNumber}-${question.subNumber} 没有赋分不能提交。`;
+      } else if (isNumber(question.maxScore) && score > question.maxScore) {
+        error = `${question.mainNumber}-${question.subNumber} 赋分大于最高分不能提交。`;
+      } else if (isNumber(question.minScore) && score < question.minScore) {
+        error = `${question.mainNumber}-${question.subNumber} 赋分小于最低分不能提交。`;
+      }
+      if (error) {
+        errors.push({ question, index, error });
+      }
+    });
+    if (errors.length) {
+      console.log(errors);
+      const msg = errors.map((v) => h("div", `${v.error}`));
+      return message.warning({
+        content: h("span", ["校验失败", ...msg]),
+        duration: 10,
+        key: mkey,
+      });
+    }
     res = await saveArbitrateTask(
       store.currentTask.libraryId + "",
       store.currentTask.studentId + "",