1

Resolved

Recurring appointments started in the past always get re-synchronized from local to GCal

description

Problem Description:
 
If there's any old recurring appointments which was started in the past, it always be considered as a "local change" and updated to GCal.
 
Reproduction Steps:
 
  1. Environment
    Windows Mobile 6.1 + GMobileSync 1.3.6
    or
    Windows Mobile 6.1 + GMobileSync SVN Revision 30939 + Visual Studio 2005 + WM SDK 6
     
  2. Create a recurring appointment in POutlook. Start date set to 1 month before today, repeats Weekly on Monday.
  3. Perform a sync using GMobileSync
  4. Perform a sync again without any modification to the appointments.
     
    Expected result:
    The second sync will do nothing. There should be no local changes
     
    Actual result:
    1 local changes has been found and sync with GCal.
     
    Analysis:
     
    The "appointmentWasChangedLocally" in SynchronizeLocalToGoogle always true for such recurring appointments started in the past.
    Reason for this is after the "appointment.RecurrencePattern.GetOccurrence(temp)" call, if an occurrence has been found, the appointment object will be changed by the function call. The appointment.Start and appointment.End will change to the matched date. The old value will lost, which case the MD5SUM of the appointment changes.
     
    Solutions:
    I was not sure why the GetOccurrence function will change the appointment object. But there is a quick dirty workaround to avoid this problem, save the old start and end value before performing the GetOccurrence function call and restore them after the call.
     

Index: GMobileSync/frmMain.cs synchronize

--- GMobileSync/frmMain.cs (revision 30939)
+++ GMobileSync/frmMain.cs (working copy)
@@ -847,16 +847,23 @@
                //the synchronization period, but where there is an occurance within the synchronization period.
                if (appointment.IsRecurring)
                {
  • DateTime oldStart = appointment.Start;
  • DateTime oldEnd = appointment.End;
  •                 DateTime start = DateTime.Now.AddDays(-1 * this._gMobileSync.SyncPreviousDays);
                    DateTime end = DateTime.Now.AddDays(this._gMobileSync.SyncFutureDays);
                    DateTime temp = start;
                    bool foundOccurance = false;
                    while ((temp <= end) && !foundOccurance)
                    {
  • if (appointment.RecurrencePattern.GetOccurrence(temp) != null)
  • foundOccurance = true;
  • else
  • temp = temp.AddDays(1);
  • if (appointment.RecurrencePattern.GetOccurrence(temp) != null)
  • {
  • appointment.Start = oldStart;
  • appointment.End = oldEnd;
  • foundOccurance = true;
  • }
  • else
  • temp = temp.AddDays(1);
                    }
                    if (!foundOccurance)
                        continue;

comments

lifanxi wrote Feb 5, 2009 at 9:51 AM

This bug fix has been merged.

[Change Set]
31052

wrote Feb 5, 2009 at 9:51 AM

wrote Feb 14, 2013 at 12:35 AM

wrote May 16, 2013 at 4:03 AM

wrote May 16, 2013 at 4:03 AM

wrote Jun 14, 2013 at 8:21 AM