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

ROENROLL-1509 add course to active term even if other courses have errors

parent 6eed0d8d
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ export interface CourseBase {
packageEnrollmentStatus?: any;
creditRange?: any;
studentEnrollmentStatus:
| null
| 'Enrolled'
| 'Waitlisted'
| 'cart'
......
......@@ -141,17 +141,11 @@ export class TermContainerComponent implements OnInit, OnDestroy {
drop(event: CdkDragDrop<TermCode>) {
const newContainer = event.container.id;
const previousContainer = event.previousContainer.id;
const { courseId } = event.item.data as Course;
const { studentEnrollmentStatus } = event.item.data as Course;
const isCourseInPlannedCourses = this.plannedCourses.some(
course => course.courseId === courseId,
);
const courseNotOfferedInTerm = this.plannedCourses.some(
course =>
course.studentEnrollmentStatus === 'DOESNOTEXIST' ||
course.studentEnrollmentStatus === 'NOTOFFERED',
);
if (newContainer !== previousContainer && isCourseInPlannedCourses) {
this.dialog
.open(ConfirmDialogComponent, {
......@@ -165,22 +159,6 @@ export class TermContainerComponent implements OnInit, OnDestroy {
.afterClosed();
return;
}
if (this.era === 'active' && courseNotOfferedInTerm) {
const notOfferedCourse =
event.item.data.subject + ' ' + event.item.data.catalogNumber;
const touchedTerm = event.container.data.description;
this.dialog
.open(ConfirmDialogComponent, {
data: {
title: "Can't add course to term",
confirmText: 'OK',
dialogClass: 'alertDialog',
text: `${notOfferedCourse} is not offered in ${touchedTerm}`,
},
})
.afterClosed();
return;
}
if (newContainer === previousContainer) {
const newIndex = event.currentIndex;
......@@ -200,6 +178,7 @@ export class TermContainerComponent implements OnInit, OnDestroy {
// Get the pervious and new term code, and the record ID
const from = event.previousContainer.data;
const to = event.container.data;
// FIXME: if `event.item.data` is a Course, the `id` property could be null
const { id, courseId, subjectCode } = event.item.data;
const newIndex = event.currentIndex;
const { classNumber } = event.item.data as Course;
......
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