-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transfer credits now add up to total credits on sidebar #746
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,7 +190,13 @@ const Sidebar: React.FC<SidebarProps> = memo( | |
concentrationValidationStatus = SidebarValidationStatus.Error; | ||
} | ||
|
||
const creditsTaken = totalCreditsInSchedule(selectedPlan.schedule); | ||
const transferCredits = transferCourses.reduce( | ||
(sum, course) => course.numCreditsMin + sum, | ||
0 | ||
); | ||
|
||
const creditsTaken = | ||
totalCreditsInSchedule(selectedPlan.schedule) + transferCredits; | ||
|
||
return ( | ||
<SidebarContainer | ||
|
@@ -247,12 +253,19 @@ const Sidebar: React.FC<SidebarProps> = memo( | |
|
||
interface NoMajorSidebarProps { | ||
selectedPlan: PlanModel<string>; | ||
transferCourses: ScheduleCourse2<unknown>[]; | ||
} | ||
|
||
export const NoMajorSidebar: React.FC<NoMajorSidebarProps> = ({ | ||
selectedPlan, | ||
transferCourses, | ||
}) => { | ||
const creditsTaken = totalCreditsInSchedule(selectedPlan.schedule); | ||
const transferCredits = transferCourses.reduce( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does the regular sidebar (the one that is not "no major") already support adding transfer course credits? if not, we should abstract the logic and add to both locations. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I believe lines 193 - 199 add to the creditsTaken variable for the normal sidebar. |
||
(sum, course) => course.numCreditsMin + sum, | ||
0 | ||
); | ||
const creditsTaken = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we move this logic calculating schedule + transfer courses into one function that returns a credit value? |
||
totalCreditsInSchedule(selectedPlan.schedule) + transferCredits; | ||
return ( | ||
<SidebarContainer | ||
title="No Major" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for adding this!