From 067ccf30f2b60e3d55c6b9de9d05f5254a8d6c38 Mon Sep 17 00:00:00 2001 From: yijen-sun Date: Sun, 1 Oct 2023 16:27:35 -0400 Subject: [PATCH] Transfer courses add to only pre-req errors (#613) --- packages/frontend-v2/pages/home.tsx | 4 ++-- .../frontend-v2/utils/plan/preAndCoReqCheck.ts | 15 ++++----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/frontend-v2/pages/home.tsx b/packages/frontend-v2/pages/home.tsx index 10d32546d..edfe71ec0 100644 --- a/packages/frontend-v2/pages/home.tsx +++ b/packages/frontend-v2/pages/home.tsx @@ -102,7 +102,7 @@ const HomePage: NextPage = () => { const plan = student.plans.find((plan) => plan.id === selectedPlanId); if (plan) { setPreReqWarnings(getPreReqWarnings(plan.schedule, student.coursesTransfered)); - setCoReqWarnings(getCoReqWarnings(plan.schedule, student.coursesTransfered)); + setCoReqWarnings(getCoReqWarnings(plan.schedule)); } } }, [student, selectedPlanId, setSelectedPlanId]); @@ -171,7 +171,7 @@ const HomePage: NextPage = () => { } setPreReqWarnings(getPreReqWarnings(updatedPlan.schedule, student.coursesTransfered)); - setCoReqWarnings(getCoReqWarnings(updatedPlan.schedule, student.coursesTransfered)); + setCoReqWarnings(getCoReqWarnings(updatedPlan.schedule)); mutateStudentWithUpdatedPlan(updatedPlan); }; diff --git a/packages/frontend-v2/utils/plan/preAndCoReqCheck.ts b/packages/frontend-v2/utils/plan/preAndCoReqCheck.ts index bd9011ef8..bcbb7a0bf 100644 --- a/packages/frontend-v2/utils/plan/preAndCoReqCheck.ts +++ b/packages/frontend-v2/utils/plan/preAndCoReqCheck.ts @@ -15,16 +15,15 @@ import { export const getCoReqWarnings = ( schedule: Schedule2, - coursesTransfered: ScheduleCourse2[] | undefined ): CoReqWarnings => { const errors: CoReqWarnings = { type: "coreq", years: schedule.years.map((year) => ({ year: year.year, - fall: getCoReqWarningsSem(year.fall, coursesTransfered), - spring: getCoReqWarningsSem(year.spring, coursesTransfered), - summer1: getCoReqWarningsSem(year.summer1, coursesTransfered), - summer2: getCoReqWarningsSem(year.summer2, coursesTransfered), + fall: getCoReqWarningsSem(year.fall), + spring: getCoReqWarningsSem(year.spring), + summer1: getCoReqWarningsSem(year.summer1), + summer2: getCoReqWarningsSem(year.summer2), })), }; return errors; @@ -32,18 +31,12 @@ export const getCoReqWarnings = ( export const getCoReqWarningsSem = ( term: ScheduleTerm2, - coursesTransfered: ScheduleCourse2[] | undefined ): TermError => { const seen: Set = new Set(); const coReqErrors: TermError = {}; for (const course of term.classes) { seen.add(courseToString(course)); } - if (coursesTransfered != undefined) { - for (const course of coursesTransfered) { - seen.add(courseToString(course)); - } - } for (const course of term.classes) { if (course.coreqs && course.coreqs.values.length !== 0) coReqErrors[courseToString(course)] = getReqErrors(course.coreqs, seen);