mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
fix duplication events
This commit is contained in:
@@ -63,9 +63,10 @@ export class CalendarService {
|
||||
}
|
||||
|
||||
removeRangeForCalendar(rangeStartDate, rangeEndDate, profile, calendarId) {
|
||||
|
||||
this._eventSource = this._eventSource.filter((e)=> {
|
||||
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
||||
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.CalendarId == calendarId) {
|
||||
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.CalendarId != calendarId) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@@ -77,16 +78,23 @@ export class CalendarService {
|
||||
let news = []
|
||||
eventsList.forEach((element, eventIndex) => {
|
||||
|
||||
news.push({
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: profile,
|
||||
id: element.EventId,
|
||||
CalendarId: CalendarId
|
||||
});
|
||||
const found = this._eventSource.find( e => e.id == element.EventId)
|
||||
|
||||
if(!found) {
|
||||
news.push({
|
||||
startTime: new Date(element.StartDate),
|
||||
endTime: new Date(element.EndDate),
|
||||
allDay: false,
|
||||
event: element,
|
||||
calendarName: element.CalendarName,
|
||||
profile: profile,
|
||||
id: element.EventId,
|
||||
CalendarId: CalendarId
|
||||
});
|
||||
} else {
|
||||
console.log('found')
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user