Przeglądaj źródła

Merge pull request #516 from linlinli000/cmc

星河欲转 3 tygodni temu
rodzic
commit
c8cd7ab6c3
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      resources/CMC/cmc_01.js

+ 4 - 2
resources/CMC/cmc_01.js

@@ -79,8 +79,10 @@ function parseCourseList(apiJson, slotMap) {
             }
             
             const key = [course.name, teacher, position, day,
-                course.isCustomTime ? actualStart + actualEnd : `${startSection}-${endSection}`, weeks.join(",")].join("__");
-            if (!courseMap.has(key)) courseMap.set(key, course);
+                course.isCustomTime ? actualStart + actualEnd : `${startSection}-${endSection}`].join("__");
+            const existing = courseMap.get(key);
+            if (existing) existing.weeks = [...new Set([...existing.weeks, ...course.weeks])].sort((a, b) => a - b);
+            else courseMap.set(key, course);
         });
     });