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 { ...@@ -57,9 +57,14 @@ export class DegreePlanEffects {
return forkJoin( return forkJoin(
this.loadTermsForPlan(stdin), this.loadTermsForPlan(stdin),
this.api.getSavedForLaterCourses(), this.api.getSavedForLaterCourses(),
this.api.getAllSubjects(),
).pipe( ).pipe(
map(([planDetails, savedForLaterCourses]) => { map(([planDetails, savedForLater, subjects]) => {
return { ...planDetails, savedForLaterCourses }; const savedForLaterCourses = savedForLater.map(course => {
course.subject = subjects[course.subjectCode];
return course;
});
return { ...planDetails, savedForLaterCourses, subjects };
}), }),
); );
}), }),
......
...@@ -67,7 +67,11 @@ export const getAllVisibleTermsByYear = createSelector( ...@@ -67,7 +67,11 @@ export const getAllVisibleTermsByYear = createSelector(
const allCourses = state.visibleTerms const allCourses = state.visibleTerms
.map(term => term.courses) .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 => { return unqiueYears.map<Year>(year => {
const century = year[0] === '0' ? 0 : 1; const century = year[0] === '0' ? 0 : 1;
......
...@@ -9,6 +9,7 @@ export interface DegreePlannerState { ...@@ -9,6 +9,7 @@ export interface DegreePlannerState {
savedForLaterCourses: SavedForLaterCourse[]; savedForLaterCourses: SavedForLaterCourse[];
activeTermCodes: string[]; activeTermCodes: string[];
allDegreePlans: DegreePlan[]; allDegreePlans: DegreePlan[];
subjects: Object;
} }
export const INITIAL_DEGREE_PLANNER_STATE: DegreePlannerState = { export const INITIAL_DEGREE_PLANNER_STATE: DegreePlannerState = {
...@@ -17,4 +18,5 @@ export const INITIAL_DEGREE_PLANNER_STATE: DegreePlannerState = { ...@@ -17,4 +18,5 @@ export const INITIAL_DEGREE_PLANNER_STATE: DegreePlannerState = {
savedForLaterCourses: [], savedForLaterCourses: [],
activeTermCodes: [], activeTermCodes: [],
allDegreePlans: [], 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