diff --git a/README.md b/README.md index ea37e1e09..0810536e8 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ GraduateNU aims to empower Northeastern students to customize their plan of stud 5. Then run the new version of the application by running `yarn dev` at the root of the project. This starts up a NestJS server + a NextJS frontend + a Proxy. The proxy listens on port [3002](http://localhost:3002/), forwards /api requests to the NestJS server running on port 3001, and all other requests to the frontend running on port 3000. +5a. For Windows machines, run `yarn concurrently "yarn workspaces foreach --parallel --verbose --interlaced run dev" "yarn dev:proxy"` instead of `yarn dev` + 6. Visit [http://localhost:3002](http://localhost:3002/) to view the app. To run the two separately, visit the frontend and api packages(sub directories of the monorepo). diff --git a/packages/frontend/components/Sidebar/Sidebar.tsx b/packages/frontend/components/Sidebar/Sidebar.tsx index e3e519cc9..ae32e7044 100644 --- a/packages/frontend/components/Sidebar/Sidebar.tsx +++ b/packages/frontend/components/Sidebar/Sidebar.tsx @@ -190,7 +190,10 @@ const Sidebar: React.FC = memo( concentrationValidationStatus = SidebarValidationStatus.Error; } - const creditsTaken = totalCreditsInSchedule(selectedPlan.schedule); + const creditsTaken = totalCreditsInSchedule( + selectedPlan.schedule, + transferCourses + ); return ( = memo( interface NoMajorSidebarProps { selectedPlan: PlanModel; + transferCourses: ScheduleCourse2[]; } export const NoMajorSidebar: React.FC = ({ selectedPlan, + transferCourses, }) => { - const creditsTaken = totalCreditsInSchedule(selectedPlan.schedule); + const creditsTaken = totalCreditsInSchedule( + selectedPlan.schedule, + transferCourses + ); return ( { transferCourses={student.coursesTransfered || []} /> ); - } else renderedSidebar = ; + } else + renderedSidebar = ( + + ); } return ( diff --git a/packages/frontend/utils/plan/totalCredits.ts b/packages/frontend/utils/plan/totalCredits.ts index 8b95603f2..22e3dc86d 100644 --- a/packages/frontend/utils/plan/totalCredits.ts +++ b/packages/frontend/utils/plan/totalCredits.ts @@ -1,4 +1,9 @@ -import { Schedule2, ScheduleTerm2, ScheduleYear2 } from "@graduate/common"; +import { + Schedule2, + ScheduleCourse2, + ScheduleTerm2, + ScheduleYear2, +} from "@graduate/common"; /** The credits for all courses in a term. */ export const totalCreditsInTerm = (term: ScheduleTerm2): number => { @@ -23,12 +28,14 @@ export const totalCreditsInYear = ( /** The credits for all courses in a schedule summed. */ export const totalCreditsInSchedule = ( - schedule: Schedule2 + schedule: Schedule2, + transfer: ScheduleCourse2[] ): number => { return ( - schedule.years.reduce( + (schedule.years.reduce( (totalCredits, year) => totalCreditsInYear(year) + totalCredits, 0 - ) ?? 0 + ) ?? 0) + + (transfer.reduce((sum, course) => course.numCreditsMin + sum, 0) ?? 0) ); };