Title: [commits] (grant) [15339] Fix Bug 10702 (r=jeffrey): changing back from "all day" event (recurring) puts event at midnight
Revision
15339
Author
grant
Date
2007-09-17 17:17:01 -0700 (Mon, 17 Sep 2007)

Log Message

Fix Bug 10702 (r=jeffrey): changing back from "all day" event (recurring) puts event at midnight

- Uncomment the unit test for this problem in TestRecurringEvent.py
- In EventStamp.updateTriageStatus(), use effectiveStartTime, not startTime,
when comparing event times for purposes of determining now/later/done.
- Fix a couple of places in Calendar.py where we set startTime to be
effectiveStartTime (EventStamp._createOccurrence,
EventStamp.changeThisAndFuture).

Modified Paths

Diff

Modified: trunk/chandler/parcels/osaf/pim/calendar/Calendar.py (15338 => 15339)

--- trunk/chandler/parcels/osaf/pim/calendar/Calendar.py	2007-09-17 18:44:22 UTC (rev 15338)
+++ trunk/chandler/parcels/osaf/pim/calendar/Calendar.py	2007-09-18 00:17:01 UTC (rev 15339)
@@ -1105,11 +1105,21 @@
         # item.
         item = first.itsItem.getMembershipItem()
         
+        #
+        # We want the effectiveStartTime of the new event to
+        # match its recurrenceID. For non-allDay/anyTime events,
+        # effectiveStartTime is just startTime, but otherwise we
+        # want the same time-of-day as our own startTime.
+        startTime = recurrenceID
         
+        if self.anyTime or self.allDay:
+            startTime = datetime.combine(startTime.date(),
+                                         self.startTime.timetz())
+        
         values = {
             EventStamp.isGenerated.name: True,
             EventStamp.recurrenceID.name: recurrenceID,
-            EventStamp.startTime.name: recurrenceID,
+            EventStamp.startTime.name: startTime,
             EventStamp.occurrenceFor.name: item,
         }
 
@@ -1654,7 +1664,7 @@
                                                         occurrence.startTime)
                                 occurrence.recurrenceID = changeRecurrenceID(
                                                                 occurrenceID)
-                
+
             elif attr in (EventStamp.allDay.name, EventStamp.anyTime.name):
                 # if startTime changes (and an allDay/anyTime change changes
                 # effective startTime), all future occurrences's recurrenceIDs
@@ -1749,7 +1759,17 @@
                     # need to reassign
                     if attr is not None:
                         setattr(newMasterItem, attr, value)
-                    newMaster.startTime = newMaster.recurrenceID = self.recurrenceID
+                    # self is starting out as the first occurrence of newMaster,
+                    # and so its recurrenceID matches its effectiveStartTime
+                    self.recurrenceID = self.effectiveStartTime
+                    
+                    # ... newMaster's recurrenceID matches self's
+                    newMaster.recurrenceID = self.recurrenceID
+                    # ... and so does its startTime. Note that, for allDay
+                    # events, self.startTime may differ from self.recurrenceID.
+                    # We want to preserve time-of-day so that the user can
+                    # uncheck "all-day" and get back the event's old time.
+                    newMaster.startTime = self.startTime
                     if newMaster.occurrenceFor:
                         del newMaster.occurrenceFor #self overrides newMaster
                     newMaster.itsItem.icalUID = str(newMasterItem.itsUUID)
@@ -2074,10 +2094,10 @@
             item = mod.itsItem
             if ((item._triageStatus == TriageEnum.done and
                  lastPastDone is not None and
-                 mod.startTime < lastPastDone) or
+                 mod.effectiveStartTime < lastPastDone) or
                 (item._triageStatus == TriageEnum.later and
                  firstFutureLater is not None and 
-                 mod.startTime > firstFutureLater)):
+                 mod.effectiveStartTime > firstFutureLater)):
 
                 if mod.isTriageOnlyModification():
                     mod.unmodify()

Modified: trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurringEvent.py (15338 => 15339)

--- trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurringEvent.py	2007-09-17 18:44:22 UTC (rev 15338)
+++ trunk/chandler/parcels/osaf/pim/calendar/tests/TestRecurringEvent.py	2007-09-18 00:17:01 UTC (rev 15339)
@@ -1183,14 +1183,10 @@
                 reallyEqual(occurrence.recurrenceID.timetz(),
                             time(0, tzinfo=self.view.tzinfo.floating))
             )
-            
-            # We should check:
-            #    reallyEqual(occurrence.startTime.timetz(),
-            #                third.startTime.timetz())
-            # but, this fails because EventStamp._createOccurrence is
-            # creating occurrences incorrectly. So far as I can tell, the
-            # Chandler UI works around this when recurring events lose
-            # allDay/anyTime. [grant 2007/08/28]
+            self.failUnless(
+                reallyEqual(occurrence.startTime.timetz(),
+                            third.startTime.timetz())
+            )
         
 
         # Now, make a THISANDFUTURE on the 2nd new event, resetting




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to