mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
fix duplication events
This commit is contained in:
@@ -611,6 +611,19 @@ export class AgendaPage implements OnInit {
|
||||
delete this.loadRequest[index]
|
||||
}
|
||||
|
||||
|
||||
removeDuplicatesByOwnerUserId = (array) => {
|
||||
const seen = new Set();
|
||||
return array.filter(item => {
|
||||
if (seen.has(item.OwnerUserId)) {
|
||||
return false;
|
||||
} else {
|
||||
seen.add(item.OwnerUserId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
async loadRangeEventRun(startTime: Date, endTime: Date) {
|
||||
|
||||
if (SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
|
||||
@@ -632,8 +645,9 @@ export class AgendaPage implements OnInit {
|
||||
this.myCal.loadEvents();
|
||||
} catch (error) {}
|
||||
|
||||
|
||||
let load = 0;
|
||||
for (const selectedCalendar of selectedCalendarIds) {
|
||||
for (const selectedCalendar of this.removeDuplicatesByOwnerUserId(selectedCalendarIds)) {
|
||||
|
||||
const response = await this.AgendaDataRepositoryService.EventList({userId: selectedCalendar.OwnerUserId, calendarOwnerName: selectedCalendar['FullName'] })
|
||||
|
||||
@@ -654,6 +668,7 @@ export class AgendaPage implements OnInit {
|
||||
this.CalendarStore.pushEvent(eventsList, label, selectedCalendar.OwnerUserId);
|
||||
|
||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||
// console.log('this.listToPresent', this.listToPresent)
|
||||
this.showTimelinePR = true;
|
||||
|
||||
load++
|
||||
|
||||
@@ -186,7 +186,7 @@ export class ViewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
setTimeZone() {
|
||||
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
||||
this.TimeZoneString = this.loadedEvent.TimeZone
|
||||
}
|
||||
|
||||
async loadEvent() {
|
||||
|
||||
Reference in New Issue
Block a user