diff --git a/src/app/degree-planner/services/termcode.factory.ts b/src/app/degree-planner/services/termcode.factory.ts index bcdef14eab0148161b5659e60e783e000587ff36..9fc13ebb3b9cc39a2617e54637d3305b252c5e18 100644 --- a/src/app/degree-planner/services/termcode.factory.ts +++ b/src/app/degree-planner/services/termcode.factory.ts @@ -23,14 +23,18 @@ export class TermCodeFactory { } private requireInitialization() { - if (this.state !== 'initialized') { + if (this.isNotInitialized()) { throw new Error('cannot use TermCodeFactory without active terms'); } } + public isNotInitialized(): boolean { + return this.state !== 'initialized'; + } + public setActiveTermCodes(active: RawTermCode[]) { - if (this.state !== 'uninitialized') { - throw new Error('the TermCodeFactory was not uninitialized'); + if (this.isNotInitialized() === false) { + throw new Error('the TermCodeFactory was already initialized'); } else if (active.length === 0) { throw new Error('app cannot have 0 active terms, must have at least 1'); } diff --git a/src/app/degree-planner/store/effects/plan.effects.ts b/src/app/degree-planner/store/effects/plan.effects.ts index 743117bc6f886222089d576e4b717688d0cccf10..9301e8d9264dfa2b0d0663008b5cb13f27466121 100644 --- a/src/app/degree-planner/store/effects/plan.effects.ts +++ b/src/app/degree-planner/store/effects/plan.effects.ts @@ -68,7 +68,10 @@ export class DegreePlanEffects { }), flatMap(({ allDegreePlans, activeTermCodes, userPreferences }) => { - this.termCodeService.setActiveTermCodes(activeTermCodes); + if (this.termCodeService.isNotInitialized()) { + this.termCodeService.setActiveTermCodes(activeTermCodes); + } + const savedForLaterCourses = this.api.getSavedForLaterCourses(); const visibleDegreePlan = userPreferences.degreePlannerSelectedPlan ? pickDegreePlanById(