From 39aa9a97db9785a1857436a6cd17ffd8203d7935 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Wed, 13 May 2015 14:36:35 -0400 Subject: [PATCH] (fix) make sure we return event blocks sorted by start date (#2939) --- UI/Scheduler/UIxCalListingActions.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/UI/Scheduler/UIxCalListingActions.m b/UI/Scheduler/UIxCalListingActions.m index 59e124326..f6690f080 100644 --- a/UI/Scheduler/UIxCalListingActions.m +++ b/UI/Scheduler/UIxCalListingActions.m @@ -75,6 +75,15 @@ static NSArray *tasksFields = nil; #define maxBlocks (offsetBlocks * 2) // maximum number of blocks to search // for a free slot (10 days) +@implementation NSArray (SOGoBlocksCompare) + +- (NSComparisonResult) compareBlock: (NSArray *) theOtherBlock +{ + return [[self objectAtIndex: 5] compare: [theOtherBlock objectAtIndex: 5]]; +} + +@end + @implementation UIxCalListingActions + (void) initialize @@ -483,7 +492,9 @@ static NSArray *tasksFields = nil; } } } - + + [infos sortUsingSelector: @selector(compareBlock:)]; + return infos; }