More performant implementation of event filter
All checks were successful
Jenkins Production Deployment
All checks were successful
Jenkins Production Deployment
This commit is contained in:
parent
bafc56d604
commit
754408dfa3
|
@ -39,9 +39,6 @@ export class AdminComponent implements OnInit {
|
|||
|
||||
this.api.getEvents(this.selectedCalendar).subscribe((events: Event[]): void => {
|
||||
for (let event of events) {
|
||||
if(!this.checkEventMeetsFilterCriteria(event)) {
|
||||
continue;
|
||||
}
|
||||
this.events.push({
|
||||
...event,
|
||||
startDateTime: new Date(event.startDateTime),
|
||||
|
@ -49,6 +46,7 @@ export class AdminComponent implements OnInit {
|
|||
createdDate: new Date(event.createdDate)
|
||||
});
|
||||
}
|
||||
this.filterEvents();
|
||||
this.sortEvents();
|
||||
});
|
||||
}
|
||||
|
@ -76,6 +74,12 @@ export class AdminComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
filterEvents() {
|
||||
this.events = this.events.filter((event) => {
|
||||
return this.checkEventMeetsFilterCriteria(event);
|
||||
});
|
||||
}
|
||||
|
||||
checkEventMeetsFilterCriteria(event: Event): boolean {
|
||||
switch (this.eventFilter) {
|
||||
case '':
|
||||
|
@ -121,6 +125,6 @@ export class AdminComponent implements OnInit {
|
|||
return 1;
|
||||
}
|
||||
return 1;
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user