Skip to content
Snippets Groups Projects
Commit a7bda9b6 authored by pnogal's avatar pnogal
Browse files

Add condition when running removeFavoriteCourse() in term-container

parent aa2e57d0
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ export class TermContainerComponent { ...@@ -15,6 +15,7 @@ export class TermContainerComponent {
@Input() term: Term; @Input() term: Term;
@Input() courses: Course[]; @Input() courses: Course[];
@Input() termCodes: String[]; @Input() termCodes: String[];
terms: any[]; terms: any[];
favoriteCourse: FavoriteCourse; favoriteCourse: FavoriteCourse;
...@@ -32,6 +33,7 @@ export class TermContainerComponent { ...@@ -32,6 +33,7 @@ export class TermContainerComponent {
} }
drop(event: CdkDragDrop<string[]>) { drop(event: CdkDragDrop<string[]>) {
if (event.previousContainer.id !== event.container.id) { if (event.previousContainer.id !== event.container.id) {
// moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); // moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
transferArrayItem(event.previousContainer.data, transferArrayItem(event.previousContainer.data,
...@@ -40,9 +42,11 @@ export class TermContainerComponent { ...@@ -40,9 +42,11 @@ export class TermContainerComponent {
event.currentIndex); event.currentIndex);
} }
this.dataService.removeFavoriteCourse(event.item.data.subjectCode, event.item.data.courseId) if (event.previousContainer.id === 'favoriteCourse-dropZone') {
.subscribe(favoriteCourse => { this.dataService.removeFavoriteCourse(event.item.data.subjectCode, event.item.data.courseId)
this.favoriteCourse = favoriteCourse; .subscribe(favoriteCourse => {
}); this.favoriteCourse = favoriteCourse;
});
}
} }
} }
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