diff --git a/src/app/degree-planner/store/effects/course.effects.ts b/src/app/degree-planner/store/effects/course.effects.ts index 9c648b77574083912853ec8c28fae048bf739150..7c10115c6e69db8712f95d7db8491163c373b88b 100644 --- a/src/app/degree-planner/store/effects/course.effects.ts +++ b/src/app/degree-planner/store/effects/course.effects.ts @@ -68,7 +68,7 @@ export class CourseEffects { toTermCode, ); - if (toTermCode.isActive()) { + if (toTermCode.isActive() && degreePlan.primary) { /** * The `updateCourseTerm` API won't force cart validation which we want * if we're adding a course to the cart. Calling the `addCourseToCart` diff --git a/src/app/degree-planner/term-container/term-container.component.html b/src/app/degree-planner/term-container/term-container.component.html index a6693bab749998aedc0826384f446efe7a87b69d..af73480f67253ebd7fd5616c1054733448a9d91d 100644 --- a/src/app/degree-planner/term-container/term-container.component.html +++ b/src/app/degree-planner/term-container/term-container.component.html @@ -18,7 +18,7 @@ type="course" [disabled]="true" [course]="course" - [era]="(term$ | async).era"> + [era]="(term$ | async).termCode.era"> </cse-course-item> </div> </div> @@ -63,7 +63,7 @@ aria-labelledby="planned-courses" type="course" [course]="course" - [era]="(term$ | async).era"> + [era]="(term$ | async).termCode.era"> </cse-course-item> </div> </div> @@ -160,27 +160,27 @@ </ng-container> </div> - <!-- If this term is an active term --> + <!-- If this term is an active term --> <ng-container *ngIf="(term$ | async).termCode.isActive()"> <mat-tab-group (selectedTabChange)="changeVisibleCredits($event)" [selectedIndex]="(enrolledCourses.length > 0) ? 0 : 1"> <mat-tab [label]="'In Progress (' + enrolledCourses.length + ')'" aria-label="In progress courses"> <ng-container cdkFocusinitial *ngTemplateOutlet="enrolled"></ng-container> </mat-tab> - <mat-tab [label]="'Cart (' + plannedCourses.length + ')'" aria-label="Cart courses"> + <mat-tab [label]="(isPrimaryPlan) ? 'Cart (' + plannedCourses.length + ')' : 'Planned (' + plannedCourses.length + ')'" [aria-label]="(isPrimaryPlan) ? 'cart courses' : 'planned courses'"> <ng-container cdkFocusinitial *ngTemplateOutlet="planned"></ng-container> </mat-tab> </mat-tab-group> </ng-container> - + <!-- If this term is a past term --> <ng-container *ngIf="(term$ | async).termCode.isPast()"> <mat-tab-group (selectedTabChange)="changeVisibleCredits($event)" [selectedIndex]="0"> <mat-tab [label]="'Completed (' + enrolledCourses.length + ')'" aria-label="Completed courses"> <ng-container cdkFocusinitial *ngTemplateOutlet="enrolled"></ng-container> </mat-tab> - <mat-tab [label]="'Cart (' + plannedCourses.length + ')'" aria-label="Cart courses"> - <ng-container cdkFocusinitial *ngTemplateOutlet="planned"></ng-container> - </mat-tab> + <mat-tab [label]="(isPrimaryPlan) ? 'Cart (' + plannedCourses.length + ')' : 'Planned (' + plannedCourses.length + ')'" [aria-label]="(isPrimaryPlan) ? 'cart courses' : 'planned courses'"> + <ng-container cdkFocusinitial *ngTemplateOutlet="planned"></ng-container> + </mat-tab> </mat-tab-group> </ng-container> diff --git a/src/app/degree-planner/term-container/term-container.component.ts b/src/app/degree-planner/term-container/term-container.component.ts index ae4fbd3b7e0d9ebbd9e65bb6ed3adc9812140068..d8557129190faf76b694852629605e9bf8e79326 100644 --- a/src/app/degree-planner/term-container/term-container.component.ts +++ b/src/app/degree-planner/term-container/term-container.component.ts @@ -68,8 +68,10 @@ export class TermContainerComponent implements OnInit, OnDestroy { public tooManyCredits$: Observable<boolean>; public termSubscription: Subscription; + public isPrimarySubscription: Subscription; public activeTermHasNotOffered: boolean; // List of courses pulled for the Observable + public isPrimaryPlan: boolean; public plannedCourses: ReadonlyArray<Course>; public enrolledCourses: ReadonlyArray<Course>; public hasItemDraggedOver: boolean; @@ -93,6 +95,14 @@ export class TermContainerComponent implements OnInit, OnDestroy { public ngOnInit() { this.hasItemDraggedOver = false; + this.isPrimarySubscription = this.store + .pipe( + select(selectors.selectVisibleDegreePlan), + filter(isntUndefined), + map(plan => plan.primary), + ) + .subscribe(plan => (this.isPrimaryPlan = plan)); + this.term$ = this.store.pipe( select(selectors.selectVisibleTerm, { termCode: this.termCode }), filter(isntUndefined), @@ -190,6 +200,7 @@ export class TermContainerComponent implements OnInit, OnDestroy { ngOnDestroy() { this.termSubscription.unsubscribe(); + this.isPrimarySubscription.unsubscribe(); } openNotesDialog(note?: PlannedTermNote) {