 TimeHelper = require '../helpers/time'
 
 TASKING_IDENTIFIERS = ['target_id', 'target_type']
+
+getIndexFromForTasking = (fromCollection, tasking) ->
+  _.findIndex(fromCollection, (fromItem) ->
+    _.isEqual(
+      _.pick(tasking, TASKING_IDENTIFIERS),
+      _.pick(fromItem, TASKING_IDENTIFIERS)
+    )
+  )
 
 getFromForTasking = (fromCollection, tasking) ->
   _.findWhere(fromCollection, _.pick(tasking, TASKING_IDENTIFIERS))

#   "due_time": "11:00"
# }...]

TaskingConfig =
  _defaults: {}
  _taskings: {}

    @_taskings[taskId] = {taskings, courseId}
    @emit("taskingsLoaded.#{taskId}")

  updateTime: (taskId, tasking) ->

  updateDate: () ->

  updateTasking: (taskId, tasking) ->
    taskingIndex = getIndexFromForTasking(@_taskings[taskId].taskings, tasking)
    @_taskings[taskId].taskings[taskingIndex] = transformTasking(tasking)

  exports:
    getDefaults: (courseId) ->
