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 9e007cac3a6bf27f7f451f5bc1dd946b13c188d0..a0c14ca9e6524c9a0f880e419674b57b04f70ed1 100644 --- a/src/app/degree-planner/term-container/term-container.component.ts +++ b/src/app/degree-planner/term-container/term-container.component.ts @@ -15,6 +15,7 @@ export class TermContainerComponent { @Input() term: Term; @Input() courses: Course[]; @Input() termCodes: String[]; + terms: any[]; favoriteCourse: FavoriteCourse; @@ -32,6 +33,7 @@ export class TermContainerComponent { } drop(event: CdkDragDrop<string[]>) { + if (event.previousContainer.id !== event.container.id) { // moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); transferArrayItem(event.previousContainer.data, @@ -40,9 +42,11 @@ export class TermContainerComponent { event.currentIndex); } - this.dataService.removeFavoriteCourse(event.item.data.subjectCode, event.item.data.courseId) - .subscribe(favoriteCourse => { - this.favoriteCourse = favoriteCourse; - }); + if (event.previousContainer.id === 'favoriteCourse-dropZone') { + this.dataService.removeFavoriteCourse(event.item.data.subjectCode, event.item.data.courseId) + .subscribe(favoriteCourse => { + this.favoriteCourse = favoriteCourse; + }); + } } }