natbat / pillarpointstewards

Website for pillarpointstewards.com
Apache License 2.0
7 stars 0 forks source link

Implement ICS sequence number for Google Calendar #118

Open simonw opened 1 year ago

simonw commented 1 year ago

https://support.google.com/calendar/thread/160470747/my-google-calendar-is-not-syncing-events-that-have-been-edited-in-my-ical-url?hl=en

Then, the actual event updates. Google calendar tracks calendar updates to make sure that no old updates will overwrite existing calendar contents. It uses the ics sequence field for that. An event in Google calendar only is updated if the sequence number in the downloaded ics file is higher than the last sequence number used.

https://icalendar.org/iCalendar-RFC-5545/3-8-7-4-sequence-number.html says:

 SEQUENCE:2

Need to figure out how to increment that correctly. Probably a count of records in the https://www.tidepoolstewards.com/admin/shifts/shiftchange/ for that team.

simonw commented 1 year ago

Relevant code: https://github.com/natbat/pillarpointstewards/blob/ec57fba4300979599b25cec36ad788bc1c4c7f15/pillarpointstewards/shifts/ics_utils.py#L52-L67

simonw commented 1 year ago

Also relevant:

simonw commented 1 year ago

I should probably update my TIL too https://til.simonwillison.net/ics/google-calendar-ics-subscribe-link