Skip to content
Snippets Groups Projects
Commit df9e8077 authored by Isaac Evavold's avatar Isaac Evavold
Browse files

ROENROLL-1421

parent df10d3ec
No related branches found
No related tags found
No related merge requests found
...@@ -13,31 +13,31 @@ ...@@ -13,31 +13,31 @@
</p> </p>
<span [ngSwitch]="status"> <span [ngSwitch]="status">
<i <i
*ngSwitchCase="'Enrolled'" *ngSwitchCase="'InProgress'"
class="material-icons in-progress-icon" class="material-icons in-progress-icon"
matTooltip="Course in progress" matTooltip="Course in progress"
matTooltipPosition="above" matTooltipPosition="above">
>check_circle</i check_circle
> </i>
<i <i
*ngSwitchCase="'Waitlisted'" *ngSwitchCase="'Waitlisted'"
class="material-icons problem-icon" class="material-icons problem-icon"
matTooltip="Course is waitlisted" matTooltip="Course is waitlisted"
matTooltipPosition="above" matTooltipPosition="above">
>report_problem</i report_problem
> </i>
<i <i
*ngSwitchCase="'Incomplete'" *ngSwitchCase="'Incomplete'"
class="material-icons error-icon" class="material-icons error-icon"
matTooltip="Course is incomplete" matTooltip="Course is incomplete"
matTooltipPosition="above" matTooltipPosition="above">
>error</i error
> </i>
</span> </span>
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutAlign="start center"> <div fxLayout="row" fxLayoutAlign="start center">
<p class="course-title">{{ course.title }}</p> <p class="course-title" [ngClass]="{ 'strikethrough': isStruckthrough }">{{ course.title }}</p>
</div> </div>
</div> </div>
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
} }
} }
.course-title.strikethrough,
.course-number.strikethrough { .course-number.strikethrough {
text-decoration: line-through; text-decoration: line-through;
} }
......
...@@ -38,7 +38,7 @@ export class CourseItemComponent implements OnInit { ...@@ -38,7 +38,7 @@ export class CourseItemComponent implements OnInit {
@Input() era?: unknown; @Input() era?: unknown;
visibleTerms: any; visibleTerms: any;
activeTerm: any; activeTerm: any;
status: string; public status: 'InProgress' | 'Waitlisted' | 'Incomplete' | 'Normal';
public visibleTermCodes$: Observable<string[]>; public visibleTermCodes$: Observable<string[]>;
public droppableTermCodes$: Observable<string[]>; public droppableTermCodes$: Observable<string[]>;
public term$: Observable<PlannedTerm>; public term$: Observable<PlannedTerm>;
...@@ -52,24 +52,25 @@ export class CourseItemComponent implements OnInit { ...@@ -52,24 +52,25 @@ export class CourseItemComponent implements OnInit {
) {} ) {}
ngOnInit() { ngOnInit() {
switch (true) { const isActive = this.era === 'active';
case this.course.studentEnrollmentStatus === 'Enrolled' && const isPast = this.era === 'past';
this.isCurrentTerm:
this.status = 'Enrolled';
break;
case this.course.studentEnrollmentStatus === 'Waitlisted':
this.status = 'Waitlisted';
break;
case !this.course.grade && this.isPastTerm:
this.status = 'Incomplete';
break;
default:
this.status = '';
}
const isPastOrActive = this.era === 'past' || this.era === 'active';
const isNotOffered = this.course.studentEnrollmentStatus === 'NOTOFFERED'; const isNotOffered = this.course.studentEnrollmentStatus === 'NOTOFFERED';
this.isStruckthrough = isPastOrActive && isNotOffered; this.isStruckthrough = (isPast || isActive) && isNotOffered;
const isIncomplete = isPast && this.course.grade === null;
const isWaitlisted = this.course.studentEnrollmentStatus === 'Waitlisted';
const isInProgress =
isActive && this.course.studentEnrollmentStatus === 'Enrolled';
if (isIncomplete) {
this.status = 'Incomplete';
} else if (isWaitlisted) {
this.status = 'Waitlisted';
} else if (isInProgress) {
this.status = 'InProgress';
} else {
this.status = 'Normal';
}
} }
onMenuOpen() { onMenuOpen() {
......
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