fix(calendar): deleted occurence of repeated event could cause some troubles with other imrbicated occurences

The fix is within SOPE/NGCards/iCalRecurrenceCalculator.m:244, the others files are juste modified to make the code more readable
This commit is contained in:
Hivert Quentin
2023-08-07 17:16:50 +02:00
parent f5f74f751a
commit f3981c4276
6 changed files with 127 additions and 135 deletions

View File

@@ -159,28 +159,28 @@ static NGCardsSaxHandler *sax = nil;
CardElement *newChild;
if (aChild)
{
childTag = [aChild tag];
newChild = nil;
mappedClass = [self classForTag: [childTag uppercaseString]];
if (mappedClass)
{
if (![aChild isKindOfClass: mappedClass])
{
childTag = [aChild tag];
newChild = nil;
mappedClass = [self classForTag: [childTag uppercaseString]];
if (mappedClass)
{
if (![aChild isKindOfClass: mappedClass])
{
//NSLog (@"warning: new child to entity '%@': '%@' converted to '%@'",
// tag, childTag, NSStringFromClass(mappedClass));
newChild = [aChild elementWithClass: mappedClass];
}
}
}
// else
// NSLog (@"warning: no mapped class for tag '%@'",
// childTag);
if (!newChild)
newChild = aChild;
[children addObject: newChild];
[newChild setParent: self];
}
if (!newChild)
newChild = aChild;
[children addObject: newChild];
[newChild setParent: self];
}
}
- (CardElement *) uniqueChildWithTag: (NSString *) aTag

View File

@@ -235,19 +235,18 @@ static Class yearlyCalcClass = Nil;
dates = [[self _dates: exdates withinRange: limits startingWithDate: first] objectEnumerator];
while ((currentDate = [dates nextObject]))
{
maxRanges = [ranges count];
for (count = maxRanges; count > 0; count--)
{
currentRange = [ranges objectAtIndex: count - 1];
compare = [[currentRange startDate] compare: currentDate];
if ((compare == NSOrderedAscending || compare == NSOrderedSame) &&
[[currentRange endDate] compare: currentDate] == NSOrderedDescending)
{
[ranges removeObjectAtIndex: count - 1];
}
}
}
{
maxRanges = [ranges count];
for (count = maxRanges; count > 0; count--)
{
currentRange = [ranges objectAtIndex: count - 1];
compare = [[currentRange startDate] compare: currentDate];
if ( compare == NSOrderedSame)
{
[ranges removeObjectAtIndex: count - 1];
}
}
}
}
+ (NSArray *)
@@ -255,7 +254,7 @@ static Class yearlyCalcClass = Nil;
firstInstanceCalendarDateRange: (NGCalendarDateRange *) _fir
recurrenceRules: (NSArray *) _rRules
exceptionRules: (NSArray *) _exRules
recurrenceDates: (NSArray *) _rDates
recurrenceDates: (NSArray *) _rDates
exceptionDates: (NSArray *) _exDates
{
NSMutableArray *ranges;
@@ -264,14 +263,10 @@ static Class yearlyCalcClass = Nil;
if ([_rRules count] > 0 || [_rDates count] > 0)
{
[self _fillRanges: ranges fromRules: _rRules
withinRange: _r startingWithDate: _fir];
[self _fillRanges: ranges fromDates: _rDates
withinRange: _r startingWithDate: _fir];
[self _removeExceptionsFromRanges: ranges withRules: _exRules
withinRange: _r startingWithDate: _fir];
[self _removeExceptionDatesFromRanges: ranges withDates: _exDates
withinRange: _r startingWithDate: _fir];
[self _fillRanges: ranges fromRules: _rRules withinRange: _r startingWithDate: _fir];
[self _fillRanges: ranges fromDates: _rDates withinRange: _r startingWithDate: _fir];
[self _removeExceptionsFromRanges: ranges withRules: _exRules withinRange: _r startingWithDate: _fir];
[self _removeExceptionDatesFromRanges: ranges withDates: _exDates withinRange: _r startingWithDate: _fir];
}
return ranges;