Fix issue with exceptions in repeating events
Fixed the display of an exception when its recurrence id is outside the current view.
This commit is contained in:
parent
4f38b5cf3f
commit
efb45bfba6
4
NEWS
4
NEWS
|
@ -1,11 +1,15 @@
|
||||||
2.0.5 (2013-02-dd)
|
2.0.5 (2013-02-dd)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
New features
|
||||||
|
-
|
||||||
|
|
||||||
Enhancements
|
Enhancements
|
||||||
- Added logging of the X-Forwarded-For HTTP header (#2229)
|
- Added logging of the X-Forwarded-For HTTP header (#2229)
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
- Don't use the cache for password lookups from login page (#2169)
|
- Don't use the cache for password lookups from login page (#2169)
|
||||||
|
- fixed issue with exceptions in repeating events
|
||||||
|
|
||||||
2.0.4b (2013-02-04)
|
2.0.4b (2013-02-04)
|
||||||
------------------
|
------------------
|
||||||
|
|
|
@ -873,7 +873,9 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
NSMutableDictionary *newRecord;
|
NSMutableDictionary *newRecord;
|
||||||
NSDictionary *oldRecord;
|
NSDictionary *oldRecord;
|
||||||
NGCalendarDateRange *newRecordRange;
|
NGCalendarDateRange *newRecordRange;
|
||||||
|
NSComparisonResult compare;
|
||||||
int recordIndex, secondsOffsetFromGMT;
|
int recordIndex, secondsOffsetFromGMT;
|
||||||
|
NSNumber *dateSecs;
|
||||||
|
|
||||||
newRecord = nil;
|
newRecord = nil;
|
||||||
recurrenceId = [component recurrenceId];
|
recurrenceId = [component recurrenceId];
|
||||||
|
@ -895,30 +897,24 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
[recurrenceId setTimeZone: tz];
|
[recurrenceId setTimeZone: tz];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([dateRange containsDate: [component startDate]] ||
|
compare = [[dateRange startDate] compare: recurrenceId];
|
||||||
[dateRange containsDate: [component endDate]])
|
if ((compare == NSOrderedAscending || compare == NSOrderedSame) &&
|
||||||
|
[[dateRange endDate] compare: recurrenceId] == NSOrderedDescending)
|
||||||
{
|
{
|
||||||
recordIndex = [self _indexOfRecordMatchingDate: recurrenceId
|
// The recurrence exception intersects with the date range;
|
||||||
inArray: ma];
|
// find the occurence and replace it with the new record
|
||||||
|
recordIndex = [self _indexOfRecordMatchingDate: recurrenceId inArray: ma];
|
||||||
if (recordIndex > -1)
|
if (recordIndex > -1)
|
||||||
|
{
|
||||||
|
if ([dateRange containsDate: [component startDate]])
|
||||||
{
|
{
|
||||||
newRecord = [self fixupRecord: [component quickRecord]];
|
newRecord = [self fixupRecord: [component quickRecord]];
|
||||||
[newRecord setObject: [NSNumber numberWithInt: 1]
|
|
||||||
forKey: @"c_iscycle"];
|
|
||||||
oldRecord = [ma objectAtIndex: recordIndex];
|
|
||||||
[newRecord setObject: [oldRecord objectForKey: @"c_recurrence_id"]
|
|
||||||
forKey: @"c_recurrence_id"];
|
|
||||||
|
|
||||||
// The first instance date is added to the dictionary so it can
|
|
||||||
// be used by UIxCalListingActions to compute the DST offset.
|
|
||||||
[newRecord setObject: [fir startDate] forKey: @"cycleStartDate"];
|
|
||||||
|
|
||||||
// We identified the record as an exception.
|
|
||||||
[newRecord setObject: [NSNumber numberWithInt: 1]
|
|
||||||
forKey: @"isException"];
|
|
||||||
|
|
||||||
[ma replaceObjectAtIndex: recordIndex withObject: newRecord];
|
[ma replaceObjectAtIndex: recordIndex withObject: newRecord];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
// The range doesn't cover the exception; remove it from the records
|
||||||
|
[ma removeObjectAtIndex: recordIndex];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
[self errorWithFormat:
|
[self errorWithFormat:
|
||||||
@"missing exception record for recurrence-id %@ (uid %@)",
|
@"missing exception record for recurrence-id %@ (uid %@)",
|
||||||
|
@ -926,16 +922,33 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// The recurrence id of the exception is outside the date range;
|
||||||
|
// simply add the exception to the records array
|
||||||
newRecord = [self fixupRecord: [component quickRecord]];
|
newRecord = [self fixupRecord: [component quickRecord]];
|
||||||
newRecordRange = [NGCalendarDateRange
|
newRecordRange = [NGCalendarDateRange
|
||||||
calendarDateRangeWithStartDate: [newRecord objectForKey: @"startDate"]
|
calendarDateRangeWithStartDate: [newRecord objectForKey: @"startDate"]
|
||||||
endDate: [newRecord objectForKey: @"endDate"]];
|
endDate: [newRecord objectForKey: @"endDate"]];
|
||||||
if ([dateRange doesIntersectWithDateRange: newRecordRange])
|
if ([dateRange doesIntersectWithDateRange: newRecordRange])
|
||||||
[ma addObject: newRecord];
|
[ma addObject: newRecord];
|
||||||
|
else
|
||||||
|
newRecord = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newRecord)
|
if (newRecord)
|
||||||
|
{
|
||||||
|
recurrenceId = [component recurrenceId];
|
||||||
|
dateSecs = [NSNumber numberWithInt: [recurrenceId timeIntervalSince1970]];
|
||||||
|
|
||||||
|
[newRecord setObject: dateSecs forKey: @"c_recurrence_id"];
|
||||||
|
[newRecord setObject: [NSNumber numberWithInt: 1] forKey: @"c_iscycle"];
|
||||||
|
// The first instance date is added to the dictionary so it can
|
||||||
|
// be used by UIxCalListingActions to compute the DST offset.
|
||||||
|
[newRecord setObject: [fir startDate] forKey: @"cycleStartDate"];
|
||||||
|
// We identified the record as an exception.
|
||||||
|
[newRecord setObject: [NSNumber numberWithInt: 1] forKey: @"isException"];
|
||||||
|
|
||||||
[self _fixExceptionRecord: newRecord fromRow: row];
|
[self _fixExceptionRecord: newRecord fromRow: row];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -961,7 +974,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||||
{
|
{
|
||||||
components = [[elements objectAtIndex: 0] allObjects];
|
components = [[elements objectAtIndex: 0] allObjects];
|
||||||
max = [components count];
|
max = [components count];
|
||||||
for (count = 1; count < max; count++)
|
for (count = 1; count < max; count++) // skip master event
|
||||||
[self _appendCycleException: [components objectAtIndex: count]
|
[self _appendCycleException: [components objectAtIndex: count]
|
||||||
firstInstanceCalendarDateRange: fir
|
firstInstanceCalendarDateRange: fir
|
||||||
fromRow: row
|
fromRow: row
|
||||||
|
|
Loading…
Reference in a new issue