chiark / gitweb /
Update changekey of master event after adjusting instances
authorMatthew Vernon <mv3@sanger.ac.uk>
Fri, 19 Oct 2018 16:53:17 +0000 (17:53 +0100)
committerMatthew Vernon <mv3@sanger.ac.uk>
Fri, 19 Oct 2018 16:53:17 +0000 (17:53 +0100)
Changing the instances (e.g. by adding a gcal_link) updates the
changekey of the master instance. So we need to reflect this in our
cache.

gooswapper.py

index dac4263a8303b4994ff53bbccae051eb287748b2..8009a978670dca3521afa5f64d2375e0bf2c385f 100644 (file)
@@ -246,11 +246,13 @@ def add_ex_to_gcal(ex_acct,
                                            body=gevent).execute()
         event.gcal_link = gevent.get("id")
         event.save(update_fields=["gcal_link"])
-        events[event.item_id] = events[event.item_id]._replace(changekey=event.changekey,gcal_link=event.gcal_link)
         if event.type=="RecurringMaster" and (event.deleted_occurrences or \
                                               event.modified_occurrences):
             modify_recurring(ex_acct,gcal_acct,gcal_tz,
                              events,event,gcal_id)
+            #changekey is updated by the above
+            event.refresh()
+        events[event.item_id] = events[event.item_id]._replace(changekey=event.changekey,gcal_link=event.gcal_link)
         
 def del_ex_to_gcal(ex_acct, gcal_acct, events, deleted, gcal_id="primary"):
     for ev_id in deleted: