Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ function startSync(){
if (eventList != null)
calendarEvents = [].concat(calendarEvents, eventList.items);
}
Logger.log("Fetched " + calendarEvents.length + " existing events from " + targetCalendarName);
var fetchedCalendarEventsCount = calendarEvents.length;
calendarEvents = calendarEvents.filter(function(event){
return event != null && (event.status == null || event.status.toString().toLowerCase() != "cancelled");
});
var skippedCancelledEventsCount = fetchedCalendarEventsCount - calendarEvents.length;
Logger.log("Fetched " + calendarEvents.length + " existing events from " + targetCalendarName + (skippedCancelledEventsCount > 0 ? " (" + skippedCancelledEventsCount + " cancelled skipped)" : ""));
for (var i = 0; i < calendarEvents.length; i++){
if (calendarEvents[i].extendedProperties != null){
calendarEventsIds[i] = calendarEvents[i].extendedProperties.private["rec-id"] || calendarEvents[i].extendedProperties.private["id"];
Expand Down Expand Up @@ -253,4 +258,4 @@ function startSync(){
// (the message text does not seem to be logged anywhere)
throw new Error('The sync operation produced errors. See log for details.');
}
}
}