Skip to content
Snippets Groups Projects
Commit 9bb40be0 authored by jvanboxtel@wisc.edu's avatar jvanboxtel@wisc.edu
Browse files

fix for subjects map

parent 8a755876
No related branches found
No related tags found
No related merge requests found
......@@ -57,9 +57,14 @@ export class DegreePlanEffects {
return forkJoin(
this.loadTermsForPlan(stdin),
this.api.getSavedForLaterCourses(),
this.api.getAllSubjects(),
).pipe(
map(([planDetails, savedForLaterCourses]) => {
return { ...planDetails, savedForLaterCourses };
map(([planDetails, savedForLater, subjects]) => {
const savedForLaterCourses = savedForLater.map(course => {
course.subject = subjects[course.subjectCode];
return course;
});
return { ...planDetails, savedForLaterCourses, subjects };
}),
);
}),
......
......@@ -67,7 +67,11 @@ export const getAllVisibleTermsByYear = createSelector(
const allCourses = state.visibleTerms
.map(term => term.courses)
.reduce((flat, nested) => flat.concat(nested), []);
.reduce((flat, nested) => flat.concat(nested), [])
.map(course => {
course.subject = state.subjects[course.subjectCode];
return course;
});
return unqiueYears.map<Year>(year => {
const century = year[0] === '0' ? 0 : 1;
......
......@@ -9,6 +9,7 @@ export interface DegreePlannerState {
savedForLaterCourses: SavedForLaterCourse[];
activeTermCodes: string[];
allDegreePlans: DegreePlan[];
subjects: Object;
}
export const INITIAL_DEGREE_PLANNER_STATE: DegreePlannerState = {
......@@ -17,4 +18,5 @@ export const INITIAL_DEGREE_PLANNER_STATE: DegreePlannerState = {
savedForLaterCourses: [],
activeTermCodes: [],
allDegreePlans: [],
subjects: {},
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment