       return tasks
    }
    
-   func averagePriority() -> TaskPriority
+   func averagePriorityOLD() -> TaskPriority
    {
       var priorityDict: [TaskPriority : Int] = [.Ages: 0, .Later : 0, .Soon : 0, .ASAP: 0]
       


import Foundation
import CoreData

public class TasksDataProvider: NSObject, NSFetchedResultsControllerDelegate
{

      
      return avgPriority ?? .Unknown
   }
   
   func averagePriority() -> TaskPriority
   {
      var avgPriority: TaskPriority = .Unknown
      if let tasks = tasksFRC.fetchedObjects as? [Task] {
         var count: Float = 0
         var avgPriorityWeight: Float = 0
         for task in tasks {
            if task.priority != .Unknown && !task.completed {
               avgPriorityWeight += task.priority.weight
               ++count
            }
         }
         
         if count > 0 {
            avgPriorityWeight /= count
            avgPriority = TaskPriority.priorityForWeight(avgPriorityWeight)
         }
      }
      return avgPriority
   }
}

extension TasksDataProvider
