Browse Source

大大简化轨迹模式下的scoreList计算

Michael Wang 4 years ago
parent
commit
0954769d0d
1 changed files with 4 additions and 35 deletions
  1. 4 35
      src/features/mark/MarkBody.vue

+ 4 - 35
src/features/mark/MarkBody.vue

@@ -78,7 +78,7 @@ import {
   getDataUrlForSplitConfig,
   loadImage,
 } from "@/utils/utils";
-import { groupBy, isNumber, sortBy } from "lodash";
+import { isNumber } from "lodash";
 // @ts-ignore
 import CustomCursor from "custom-cursor.js";
 
@@ -534,31 +534,6 @@ export default defineComponent({
         if (store.setting.mode !== ModeEnum.TRACK) return;
         const markResult = findCurrentTaskMarkResult();
         if (markResult && store.currentMarkResult) {
-          const scoreGroups = groupBy(
-            markResult.trackList,
-            (obj) =>
-              (obj.mainNumber + "").padStart(10, "0") +
-              obj.subNumber.padStart(10, "0")
-          );
-          const questionWithScore = Object.entries(scoreGroups);
-          const questionWithTotalScore = questionWithScore.map((v) => [
-            v[0],
-            v[1]
-              .map((s) => Math.round(s.score * 100))
-              .reduce((acc, c) => (acc += c), 0) / 100,
-          ]);
-          const questionWithTotalScoreSorted = sortBy(
-            questionWithTotalScore,
-            (obj) => obj[0]
-          );
-          const scoreList = questionWithTotalScoreSorted.map((s) => s[1]);
-          // console.log(
-          //   scoreGroups,
-          //   questionWithScore,
-          //   questionWithTotalScore,
-          //   questionWithTotalScoreSorted,
-          //   scoreList
-          // );
           const cq = store.currentQuestion;
           // 当无轨迹时,不更新;无轨迹时,将分数置null
           if (cq) {
@@ -580,7 +555,6 @@ export default defineComponent({
               cq.score = cq.__origScore;
             }
           }
-          markResult.scoreList = scoreList as number[];
           // renderPaperAndMark();
         }
       },
@@ -591,14 +565,9 @@ export default defineComponent({
     watchEffect(() => {
       const markResult = findCurrentTaskMarkResult();
 
-      // 普通模式更新分数时
-      if (store.setting.mode === ModeEnum.COMMON) {
-        if (markResult && store.currentTask) {
-          const scoreList = store.currentTask.questionList.map((q) => q.score);
-          markResult.scoreList = [...(scoreList as number[])];
-        }
-      }
-      if (markResult && markResult.scoreList && store.currentTask) {
+      if (markResult && store.currentTask) {
+        const scoreList = store.currentTask.questionList.map((q) => q.score);
+        markResult.scoreList = [...(scoreList as number[])];
         markResult.markerScore =
           (markResult.scoreList.filter((s) => isNumber(s)) as number[]).reduce(
             (acc, v) => (acc += Math.round(v * 100)),