See ChangeLogs.

Monotone-Parent: 8d68561f51adcd8910568babcba5d38587755f06
Monotone-Revision: 18a37cc2e34898697d26aa8ab49aaab61673a465

Monotone-Author: flachapelle@inverse.ca
Monotone-Date: 2010-04-22T13:15:04
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Francis Lachapelle 2010-04-22 13:15:04 +00:00
parent 7c4a7d491f
commit ed80559b05
5 changed files with 42 additions and 14 deletions

View File

@ -1,3 +1,9 @@
2010-04-22 Francis Lachapelle <flachapelle@inverse.ca>
* Tests/Unit/TestiCalRecurrenceCalculator.m: new test module for
iCalRecurrenceRule. Added full test method for
recurrenceRangesWithinCalendarDateRange:.
2010-04-21 Wolfgang Sourdeau <wsourdeau@inverse.ca> 2010-04-21 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Main/SOGo+DAV.m: commented out incomplete code for handling * Main/SOGo+DAV.m: commented out incomplete code for handling

View File

@ -1,3 +1,15 @@
2010-04-22 Francis Lachapelle <flachapelle@inverse.ca>
* iCalYearlyRecurrenceCalculator.m
(-recurrenceRangesWithinCalendarDateRange:): the rule interval
must be reset to 1 when using the monthly calculator since the
interval is related to the yearly frequency. Also fixed the month
counter with respect to the recurrence interval.
* iCalWeeklyRecurrenceCalculator.m
(-recurrenceRangesWithinCalendarDateRange:): fixed the computation
of the week number which results in a bad verification of the interval.
2010-04-19 Francis Lachapelle <flachapelle@inverse.ca> 2010-04-19 Francis Lachapelle <flachapelle@inverse.ca>
* iCalByDayMask.[h|m]: new class that computes complex BYDAY constraints. * iCalByDayMask.[h|m]: new class that computes complex BYDAY constraints.

View File

@ -168,8 +168,11 @@
{ {
[currentStartDate years:NULL months:NULL days:(int *)&days hours:NULL [currentStartDate years:NULL months:NULL days:(int *)&days hours:NULL
minutes:NULL seconds:NULL sinceDate: firStart]; minutes:NULL seconds:NULL sinceDate: firStart];
week = days / 7;
// The following adjustment always set the first day of the
// week to Sunday, ie WKST is ignored.
week = (days + [firStart dayOfWeek]) / 7;
if ((week % interval) == 0 && if ((week % interval) == 0 &&
[dayMask occursOnDay: [currentStartDate dayOfWeek]]) [dayMask occursOnDay: [currentStartDate dayOfWeek]])
isRecurrence = YES; isRecurrence = YES;

View File

@ -120,12 +120,12 @@
*/ */
// Instantiate a MONTHLY calculator // Instantiate a MONTHLY calculator
if (repeatCount > 0) // Fool the monthly calculator, otherwise it will verify the COUNT
// Fool the monthly calculator, otherwise it will verify the COUNT // constraint and perform the calculation from the first occurence of
// constraint and perform the calculation from the first occurence of // the recurrence. This calculation is performed by the current method.
// the recurrence. This calculation is performed by the current method. // The interval must be ignored as well since it refers to the years.
[rrule setRepeatCount: 0]; [rrule setRepeatCount: 0];
[rrule setInterval: @"1"];
monthlyCalc = [[iCalMonthlyRecurrenceCalculator alloc] monthlyCalc = [[iCalMonthlyRecurrenceCalculator alloc]
initWithRecurrenceRule: rrule initWithRecurrenceRule: rrule
firstInstanceCalendarDateRange: firstRange]; firstInstanceCalendarDateRange: firstRange];
@ -161,7 +161,7 @@
currentMonth = [referenceDate monthOfYear]; currentMonth = [referenceDate monthOfYear];
for (yearIdxInRange = 0 ; yearIdxInRange < numberOfYearsInRange; yearIdxInRange++) for (yearIdxInRange = 0 ; yearIdxInRange < numberOfYearsInRange; yearIdxInRange++)
{ {
int test, year; int k, test, year;
test = diff + yearIdxInRange; test = diff + yearIdxInRange;
if ((test >= 0) && (test % interval) == 0) if ((test >= 0) && (test % interval) == 0)
@ -184,12 +184,11 @@
days: 0]; days: 0];
rEnd = [rStart dateByAddingYears: 0 rEnd = [rStart dateByAddingYears: 0
months: 0 months: 0
days: [rStart numberOfDaysInMonth] - 1]; days: [rStart numberOfDaysInMonth]];
rangeForMonth = [NGCalendarDateRange calendarDateRangeWithStartDate: rStart rangeForMonth = [NGCalendarDateRange calendarDateRangeWithStartDate: rStart
endDate: rEnd]; endDate: rEnd];
rangesInMonth = [monthlyCalc recurrenceRangesWithinCalendarDateRange: rangeForMonth]; rangesInMonth = [monthlyCalc recurrenceRangesWithinCalendarDateRange: rangeForMonth];
int k;
for (k = 0; k < [rangesInMonth count] && (repeatCount == 0 || count < repeatCount); k++) { for (k = 0; k < [rangesInMonth count] && (repeatCount == 0 || count < repeatCount); k++) {
//NSLog(@"*** YEARLY found %@ (count = %i)", [[rangesInMonth objectAtIndex: k] startDate], count); //NSLog(@"*** YEARLY found %@ (count = %i)", [[rangesInMonth objectAtIndex: k] startDate], count);
count++; count++;
@ -224,12 +223,19 @@
} }
} }
} }
else
{
// Year was skipped, added 12 months to the counter
monthDiff += 12;
}
} }
if (byMonth && repeatCount > 0) if (byMonth)
// Restore the repeat count {
[rrule setRepeatCount: repeatCount]; // Restore the repeat count and interval
[rrule setRepeatCount: repeatCount];
[rrule setRepeatInterval: interval];
}
return ranges; return ranges;
} }

View File

@ -15,6 +15,7 @@ $(TEST_TOOL)_OBJC_FILES += \
SOGoTestRunner.m \ SOGoTestRunner.m \
\ \
TestiCalTimeZonePeriod.m \ TestiCalTimeZonePeriod.m \
TestiCalRecurrenceCalculator.m \
\ \
TestBSJSONAdditions.m TestBSJSONAdditions.m