diff --git a/apps/backend/src/scripts/update-catalog.ts b/apps/backend/src/scripts/update-catalog.ts index c50b9f685..c6f2ac5af 100644 --- a/apps/backend/src/scripts/update-catalog.ts +++ b/apps/backend/src/scripts/update-catalog.ts @@ -297,11 +297,17 @@ const initialize = async () => { temporalPosition: { $in: ["Current", "Future"] }, }).lean(); + // Remove duplicate terms + const filteredTerms = currentTerms.filter( + ({ id }, index) => + index === currentTerms.findIndex((term) => term.id === id) + ); + console.log("\n=== UPDATE CLASSES ==="); - await updateClasses(currentTerms); + await updateClasses(filteredTerms); console.log("\n=== UPDATE SECTIONS ==="); - await updateSections(currentTerms); + await updateSections(filteredTerms); } catch (error) { console.error(error);