dcppc / calendars

Scripts for combining Groups.io calendars into a single integrated Data Commons Google Calendar. https://calendars.nihdatacommons.us
1 stars 0 forks source link

Re-strategize calendar sync algorithm #13

Open charlesreid1 opened 6 years ago

charlesreid1 commented 6 years ago

We're having problems with events that were deleted on the Groups.io calendars not being deleted on the Google Calendars integrated feed. We're also having problems with events that look stale (like, non-functional hyperlinks, which we fixed a while back).

If we clear the calendar and re-make every event, each time - and disable notifications for new/updated/deleted events - then each event will always be getting a different ID.

This shouldn't be a problem - this Google Calendar is not intended to be an authoritative calendar, it is simply a utilitarian calendar that aggregates events, for the purpose of feeding those events to Slack, or providing a one-page embedded Google Calendar.

Switch over to the approach of re-making everything.

charlesreid1 commented 5 years ago

This should happen in util_gcal.py in the update_gcal_from_components_map() method: https://github.com/dcppc/calendars/blob/master/scripts/util_gcal.py#L209

This method takes an iCalendar components map (basically, an iCal turned into a dictionary) and checks which events already exist on a calendar, versus which need to be updated.

There may be an issue with simply deleting and re-making events all the time - if we re-make events, it will create a new event ID each time, and a new permalink, so people's links to calendar events will constantly be broken.