@@ -678,13 +678,13 @@ -(BOOL)includeTaskInReminder:(APCTaskReminder *)taskReminder{
678678
679679+ (NSArray *)findNewTasksFromOld : (NSArray *) oldTaskGroups
680680 toNewTaskGroups : (NSArray *) newTaskGroups
681- withActivityReminderDuration : (NSInteger ) daysIncomplete
682- {
681+ withActivityReminderDuration : (NSInteger ) daysIncomplete {
682+
683683 NSArray * oldTasks = [oldTaskGroups valueForKey: @" task" ];
684684 NSMutableArray * oldTaskIds = [[oldTasks valueForKey: @" taskID" ] mutableCopy ];
685685
686- NSMutableDictionary * oldTaskCompletedStatusById = [@{} mutableCopy ];
687- NSMutableDictionary * oldTaskById = [@{} mutableCopy ];
686+ NSMutableDictionary * oldTaskCompletedStatusById = [NSMutableDictionary dictionary ];
687+ NSMutableDictionary * oldTaskById = [NSMutableDictionary dictionary ];
688688
689689 for (APCTaskGroup* taskGroup in oldTaskGroups) {
690690 oldTaskCompletedStatusById[taskGroup.task.taskID] = @(taskGroup.isFullyCompleted );
@@ -696,30 +696,26 @@ + (NSArray*)findNewTasksFromOld:(NSArray*) oldTaskGroups
696696 // 2) for any task, if the task was completed in old, but is incomplete in new
697697 // 3) for activities, if the task is incomplete, old task is less than 3 days old, and new
698698 // task is more than 3 days old
699- NSMutableArray * newTasks = [@[] mutableCopy ];
700- for (APCTaskGroup* taskGroup in newTaskGroups)
701- {
699+ NSMutableArray * newTasks = [NSMutableArray array ];
700+ for (APCTaskGroup* taskGroup in newTaskGroups) {
701+
702702 APCTask* task = taskGroup.task ;
703703
704704 // Condition 1)
705- if (![oldTaskIds containsObject: task.taskID])
706- {
705+ if (![oldTaskIds containsObject: task.taskID]) {
707706 [newTasks addObject: task];
708707 }
709708 // Condition 2)
710709 else if ([oldTaskCompletedStatusById[task.taskID] boolValue ] == YES &&
711- taskGroup.isFullyCompleted == NO )
712- {
710+ taskGroup.isFullyCompleted == NO ) {
713711 [newTasks addObject: task];
714712 }
715- else if ([task.taskType isEqualToNumber: @(APCTaskTypeActivityTask)])
716- {
713+ else if ([task.taskType isEqualToNumber: @(APCTaskTypeActivityTask)]) {
717714 APCTask* oldTask = oldTaskById[task.taskID];
718715 // Condition 3)
719716 if (taskGroup.isFullyCompleted == NO &&
720717 [self isTask: oldTask olderThan: daysIncomplete] == NO &&
721- [self isTask: task olderThan: daysIncomplete] == YES )
722- {
718+ [self isTask: task olderThan: daysIncomplete] == YES ) {
723719 [newTasks addObject: task];
724720 }
725721 }
@@ -729,8 +725,8 @@ + (NSArray*)findNewTasksFromOld:(NSArray*) oldTaskGroups
729725}
730726
731727+ (BOOL ) isTask : (APCTask*) task
732- olderThan : (NSInteger ) days
733- {
728+ olderThan : (NSInteger ) days {
729+
734730 NSInteger daysBetweenFromNow = [NSDate daysBetweenDate: task.updatedAt andDate: [NSDate date ]];
735731 return daysBetweenFromNow > days;
736732}
0 commit comments