diff --git a/packages/frontend-v2/pages/home.tsx b/packages/frontend-v2/pages/home.tsx index 9be1b6890..edfe71ec0 100644 --- a/packages/frontend-v2/pages/home.tsx +++ b/packages/frontend-v2/pages/home.tsx @@ -101,7 +101,7 @@ const HomePage: NextPage = () => { if (student) { const plan = student.plans.find((plan) => plan.id === selectedPlanId); if (plan) { - setPreReqWarnings(getPreReqWarnings(plan.schedule)); + setPreReqWarnings(getPreReqWarnings(plan.schedule, student.coursesTransfered)); setCoReqWarnings(getCoReqWarnings(plan.schedule)); } } @@ -170,7 +170,7 @@ const HomePage: NextPage = () => { return; } - setPreReqWarnings(getPreReqWarnings(updatedPlan.schedule)); + setPreReqWarnings(getPreReqWarnings(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 0318b60a9..bcbb7a0bf 100644 --- a/packages/frontend-v2/utils/plan/preAndCoReqCheck.ts +++ b/packages/frontend-v2/utils/plan/preAndCoReqCheck.ts @@ -8,12 +8,13 @@ import { INEUReqError, PreReqWarnings, Schedule2, + ScheduleCourse2, ScheduleTerm2, TermError, } from "@graduate/common"; export const getCoReqWarnings = ( - schedule: Schedule2 + schedule: Schedule2, ): CoReqWarnings => { const errors: CoReqWarnings = { type: "coreq", @@ -29,7 +30,7 @@ export const getCoReqWarnings = ( }; export const getCoReqWarningsSem = ( - term: ScheduleTerm2 + term: ScheduleTerm2, ): TermError => { const seen: Set = new Set(); const coReqErrors: TermError = {}; @@ -44,9 +45,15 @@ export const getCoReqWarningsSem = ( }; export const getPreReqWarnings = ( - schedule: Schedule2 + schedule: Schedule2, + coursesTransfered: ScheduleCourse2[] | undefined ): PreReqWarnings => { const seen: Set = new Set(); + if (coursesTransfered != undefined) { + for (const course of coursesTransfered) { + seen.add(courseToString(course)); + } + } const preReqErrors: PreReqWarnings = { type: "prereq", years: schedule.years.map((year) => ({