I'd like to hear some ideas how to sync calendar events. Say I have two calendars having fields (id, title, start, end, updated, location and description). I'm struggling with starting point. Its easy if all events are new and not overlapping with each other. But say I already have events on calendars, some are supposedly same events, some are separate events, some maybe same events, but their attributes have changed, like location, title, start and end time. How would you actually make sync between calendars with reasonable smart functionality?
|
|
For each event, besides its "event time" you also need to keep track of one more time attribute, the time of last modification. This takes care of the simple and, ehm, lets say, uneventful sync scenario: events that have been modified since the last sync time get copied over. The problems start if there is a possibility that two events may have both been modified since the last sync, and you don't want changed attributes from one overwriting changed attributes in the other. We call this situation a "conflict". In order to overcome conflicts, you could keep track of the time of last modification of each attribute within an event, but this would a) complicate things a lot, and b) it would only fix conflicts in the cases when dissimilar attributes have been changed. You would still have a problem when the same attribute has been changed. So, a better approach for handling conflicts is to always present the user with the two records side by side, highlight for them the changed attributes, and let them decide which changed attribute of the left record overwrites the corresponding attribute on the right record, and vice versa. The case of overlapping events can also be seen as a conflict, which though needs to be handled specially: either the duration of one event (the one occurring earlier in time) will need to be shortened, or the starting time of the other event (the one occurring later in time) will have to be moved forward, possibly also adjusting its duration. |
|||||||
|
|
if every event has a unique "eventID" and a datetime field for "lastmodified" the case is easy. (i use these for ical events in mozilla-calendar and msoutlook 2010). since my motorola handset calender does not have the eventid i have a copy of the events on the pc that includes the eventid. you also need this local copy if you want to handle "deleted events" because else deletions will reapear after syncing. |
|||
|
|