Skip to main content

Current Plan Slice

The slice holding information about the current type.

State

type CurrentPlanSlice = {
plan: Plan;
distributions: [string, requirements[]][];
currentPlanCourses: UserCourse[];
totalCredits: number;
droppables: DroppableType[];
importing: boolean;
};
PropertyTypeDescription
planPlanThe current Plan that the user has
distributionsArray of a mapping of string to requirementsContains requirements that need to be completed for the major
currentPlanCoursesArray of UserCourseContains list of all courses that user took
totalCreditsnumberNumber of credits that the user has
droppablesArray of DroppableType
importingbooleanDetermines whether the plan was imported

Reducers

ReducerAction Payload TypeState Affected
updateSelectedPlanPlanplan
updateDistributionsArray of a mapping of string to requirementsdistributions
updateCurrentPlanCoursesArray of UserCoursecurrentPlanCourses
updateTotalCreditsnumbertotalCredits
resetCurrentPlanNoneplan, distributions, and currentPlanCourses
updateDroppablesDroppableTypedroppables
updateImportingStatusbooleanimporting

updateSelectedPlan

Used to update the current plan that a user has

ComponentDescription
HandleUserEntryDummyMakes initial plan of user if there are initially none in processYears
HandleUserEntryDummyUpdates current plan from an imported plan in addImportedYears
HandleUserEntryDummyUpdates current plan when courses are finished importing in handleFinishAdding
HandleUserEntryDummyAfter receiving all plans from a user, if there are no plans then initialize a plan in getPlans
CourseListUpdates years of a plan in swapYear
CourseListUpdates courses of a plan in swapCourse
SemesterUpdates plan when a new plan is made from the user in handlePostResponse
YearComponentUpdates plan with new year names in updateName
YearSettingsDropdownUpdates plan with a new year in handleYearChange
ActionBarUpdates name of plan in updateName
ActionBarUpdates plan when a year is added to the plan in addNewYear
PlanChooseChanges current plan to new one user selected in handlePlanChange
CourseDisplayPopupUpdate plan in handlePostAddCourse
DeleteCoursePopupUpdate plan after deleting course in activateDeleteCourse
DeletePlanPopupUses different plan after deleting current plan in deleteCurrentPlan
DeleteYearPopupUpdates plan after a year is deleted from it in activateDeleteYear
CourseDisplayUpdates plan after years are changed in updateDistributions
PlaceholderUpdates plan after years are changed in handleUpdateResponse
SisCourseUpdates plan after years are changed in handleUpdate
GenerateNewPlanUpdates new plan after making distributions

updateDistributions

Used to update the distributions of a plan that a user has

ComponentDescription
InfoMenuUsed in setDistributions which is a wrapper for this reducer

updateCurrentPlanCourses

Used to update the list of courses that a user is taking in a plan.

ComponentDescription
HandleUserEntryDummyUsed in handleFinishAdding when courses are finished importing
CourseListUsed in useEffect when certain fields are updated
CourseListUsed in updatePlanCourses after dragging semesters
SemesterUsed in handlePostResponse after adding a new course
CourseDisplayPopupUsed in handlePostAddCourse after adding a new course
CourseDisplayUsed in updateDistributions when a course in a distribution is added
PlaceholderUsed in handleUpdateResponse when updating a course
SisCourseUsed in handleUpdate when deleting old course and adding new

updateTotalCredits

Used to update the total credits a user has.

ComponentDescription
CourseListUsed in useEffect when generating year objects
CourseDisplayUsed in updateDistributions when distributions are fulfilled

resetCurrentPlan

Used to reset the plan to an empty state.

ComponentDescription
UserSectionUsed when user log ins and needs to reset the plan

updateDroppables

Used to edit the drop logic with courses and semesters.

ComponentDescription
CourseListUsed in useEffect when generating year objects
CourseDisplayUsed in updateDistributions when distributions are fulfilled

updateImportingStatus

Used to change the flag of whether something was imported or not.

ComponentDescription
HandleUserEntryDummyUsed in addImportedYears and sets to false if nothing was imported
HandleUserEntryDummyUsed in handleFinishAdding and sets to false if no newly imported courses were added
HandleUserEntryDummyUsed in useEffect on the first time page is loaded and sets to true when successful in loading user's data
HandleUserEntryDummyUsed in handleExistingUser if failed to load in user's data and sets to false

Selectors

SelectorProperty
selectPlanplan
selectDistributionsdistributions
selectCurrentPlanCoursescurrentPlanCourses
selectTotalCreditstotalCredits
selectDroppablesdroppables
selectImportingStatusimporting

selectPlan

ComponentDescription
AppGives starting plan when the website begins
HandleUserEntryDummyGives starting plan when the login begins
InfoMenuGives starting plan when Info Menu (degree plan and information) begins
CourseComponentGives starting plan when a Course is created
CourseListGives starting plan when CourseList is created
SemesterGives starting plan when Semester is created
YearComponentGives starting plan when YearComponent is created
YearSettingsDropdownGives starting plan when YearSettingsDropdown is created
ActionBarGives starting plan when ActionBar is created
PlanChooseGives starting plan when drop down of choosing a plan is created
DeleteCoursePopupGives starting plan when pop up for deleting a course happens
DeletePlanPopupGives starting plan when pop up for deleting a plan happens
DeleteYearPopupGives starting plan when pop up for deleting a year happens
SearchGives starting plan when searching for a course happens
PrereqDisplayGives starting plan when prereqs of a course are shown
FormGives starting plan when search form is submitted
CourseDisplayGives starting plan when selecting a course after searching
PlaceHolderGives starting plan when a placeholder is needed for a plan
SisCourseGives starting plan when looking at a SIS course

selectDistributions

ComponentDescription
InfoMenuGives distributions when InfoMenu starts
CourseBarGives the distributions when the bar needs to be updated

selectCurrentPlanCourses

ComponentDescription
HandleUserEntryDummyUsed to update the currentCourses a user has when logging in
InfoMenuUsed to update the currentCourses a user has fulfilled distributions
CourseComponentUsed to determine if a user has the pre reqs completed before adding the course
CourseListUsed to retrieve a course based on id, to swap courses based on droppables, update courses
SemesterUsed to update the databse when a post request is made
CourseBarUsed to help with deciding how to fill up the credit bar
FineDistributionUsed to update the fine distributions bar
CourseDisplayPopupUsed to update the currentPlanCourses after adding courses
PrereqDisplayUsed to help display pre reqs for courses and whether satisfied
CourseDisplayUsed to update the currentPlanCourses after distributions were updated
PlaceHolderUsed to update the courses after deleting a course and adding new
SisCourseUsed to update the courses after deleting a course and adding new in SIS

selectTotalCredits

ComponentDescription
DistributionsHelps in determining how filled up the Course Bar will be
CourseDisplayHelps in updating the total credits when changing

selectDroppables

ComponentDescription
CourseListHelps in displaying the courses with the drag and drop effect

selectImportingStatus

ComponentDescription
indexConditional for adding plan from import
GenerateNewPlanConditional for rendering popup of creating plan