Michael Wang 4 yıl önce
ebeveyn
işleme
2e7cb465ad

+ 5 - 4
src/features/mark/MarkBoardTrack.vue

@@ -200,10 +200,11 @@ export default defineComponent({
           q.subNumber === store.currentQuestion?.subNumber &&
           q.number === maxNumber
       );
-      store.removeScoreTracks = store.currentMarkResult.trackList.splice(
-        idx,
-        1
-      );
+      if (idx > 0)
+        store.removeScoreTracks = store.currentMarkResult.trackList.splice(
+          idx,
+          1
+        );
     }
 
     function clearAllMarksOfCurrentQuetion() {

+ 2 - 2
src/features/mark/store.ts

@@ -89,7 +89,7 @@ export function removeOldPreviousMarkResult() {
     const i = store.markResults.findIndex(
       (s) => s.libraryId === libraryId && s.studentId === studentId
     );
-    store.markResults.splice(i, 1);
+    if (i > 0) store.markResults.splice(i, 1);
   }
 
   for (const task of store.historyTasks) {
@@ -106,7 +106,7 @@ export function removeCurrentMarkResult() {
     const i = store.markResults.findIndex(
       (s) => s.libraryId === libraryId && s.studentId === studentId
     );
-    store.markResults.splice(i, 1);
+    if (i > 0) store.markResults.splice(i, 1);
   }
 
   clearMarkResultFromTask(store.currentTask);

+ 3 - 3
src/utils/utils.ts

@@ -15,7 +15,7 @@ export async function loadImage(url: string): Promise<HTMLImageElement> {
   if (store.currentTask && weakedMapImages.get(store.currentTask)) {
     const imagesCache = weakedMapImages.get(store.currentTask);
     if (imagesCache) {
-      // console.log("cached image");
+      // console.log("cached image", url);
       const image = imagesCache.get(url);
       if (image) return image;
     }
@@ -56,7 +56,7 @@ export function getDataUrlForSliceConfig(
   if (store.currentTask && weakedMapDataUrls.get(store.currentTask)) {
     const dataUrlsCache = weakedMapDataUrls.get(store.currentTask);
     if (dataUrlsCache) {
-      // console.log("cached canvas");
+      // console.log("cached canvas", key);
       const image = dataUrlsCache.get(key);
       if (image) return image;
     }
@@ -109,7 +109,7 @@ export function getDataUrlForSplitConfig(
   if (store.currentTask && weakedMapDataUrls.get(store.currentTask)) {
     const dataUrlsCache = weakedMapDataUrls.get(store.currentTask);
     if (dataUrlsCache) {
-      // console.log("cached canvas");
+      // console.log("cached canvas", key);
       const image = dataUrlsCache.get(key);
       if (image) return image;
     }