Monotone-Parent: 73df13fd7742a193f9bf1842a6f410e95c3c2e91
Monotone-Revision: 9327fed453d6acee03f0449816dbb2b401353927 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-11T18:51:30 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
69123dee65
commit
9d33c75a28
|
@ -1,5 +1,8 @@
|
|||
2006-10-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/NSObject+AptComparison.m ([NSObject
|
||||
-compareAptsAscending:_other]): accept empty start or end dates.
|
||||
|
||||
* SoObjects/Appointments/SOGoAppointmentFolder.m
|
||||
([SOGoAppointmentFolder
|
||||
-fetchFields:_fieldsfromFolder:_folderfrom:_startDateto:_endDatecomponent:_component]): added a "component" parameter to match the query against the specified component types. Made startDate and endDate optional by ignoring them altogether in the query whenever one of them is nil.
|
||||
|
|
|
@ -26,32 +26,49 @@
|
|||
|
||||
@implementation NSObject (SOGoAptComparison)
|
||||
|
||||
- (NSComparisonResult)compareAptsAscending:(id)_other {
|
||||
- (NSComparisonResult) compareAptsAscending: (id) _other
|
||||
{
|
||||
NSCalendarDate *sd, *ed;
|
||||
NGCalendarDateRange *r1, *r2;
|
||||
NSComparisonResult result;
|
||||
NSTimeInterval t1, t2;
|
||||
|
||||
sd = [self valueForKey:@"startDate"];
|
||||
ed = [self valueForKey:@"endDate"];
|
||||
r1 = [NGCalendarDateRange calendarDateRangeWithStartDate:sd
|
||||
endDate:ed];
|
||||
|
||||
sd = [_other valueForKey:@"startDate"];
|
||||
ed = [_other valueForKey:@"endDate"];
|
||||
r2 = [NGCalendarDateRange calendarDateRangeWithStartDate:sd
|
||||
endDate:ed];
|
||||
|
||||
result = [r1 compare:r2];
|
||||
if (result != NSOrderedSame)
|
||||
return result;
|
||||
|
||||
t1 = [r1 duration];
|
||||
t2 = [r2 duration];
|
||||
if (t1 == t2)
|
||||
return NSOrderedSame;
|
||||
if (t1 > t2)
|
||||
return NSOrderedDescending;
|
||||
|
||||
sd = [self valueForKey: @"startDate"];
|
||||
ed = [self valueForKey: @"endDate"];
|
||||
if (sd && ed)
|
||||
r1 = [NGCalendarDateRange calendarDateRangeWithStartDate: sd
|
||||
endDate: ed];
|
||||
else
|
||||
r1 = nil;
|
||||
|
||||
sd = [_other valueForKey: @"startDate"];
|
||||
ed = [_other valueForKey: @"endDate"];
|
||||
if (sd && ed)
|
||||
r2 = [NGCalendarDateRange calendarDateRangeWithStartDate: sd
|
||||
endDate: ed];
|
||||
else
|
||||
r2 = nil;
|
||||
|
||||
if (r1)
|
||||
if (r2)
|
||||
{
|
||||
result = [r1 compare: r2];
|
||||
if (result != NSOrderedSame)
|
||||
return result;
|
||||
|
||||
t1 = [r1 duration];
|
||||
t2 = [r2 duration];
|
||||
if (t1 == t2)
|
||||
return NSOrderedSame;
|
||||
if (t1 > t2)
|
||||
return NSOrderedDescending;
|
||||
}
|
||||
else
|
||||
return NSOrderedDescending;
|
||||
else
|
||||
if (!r2)
|
||||
return NSOrderedSame;
|
||||
|
||||
return NSOrderedAscending;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue