 
 import Foundation
 import CoreData
+
+private extension TaskPriority
+{
+   static func priorityForWeight(weight: Float) -> TaskPriority
+   {
+      let roundedWeight = round(weight)
+      switch roundedWeight
+      {
+      case 1: return .Ages
+      case 2: return .Later
+      case 3: return .Soon
+      case 4: return .ASAP
+      default: return .Unknown
+      }
+   }
+   
+   var weight: Float {
+      switch self {
+      case .Unknown: return 0
+      case .Ages: return 1
+      case .Later: return 2
+      case .Soon: return 3
+      case .ASAP: return 4
+      }
+   }
+}
 
 public class TasksDataProvider: NSObject, NSFetchedResultsControllerDelegate
 {

      
      return avgPriority ?? .Unknown
   }
}

extension TasksDataProvider

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