 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))

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

  updateDateTime: () ->

  updateDate: () ->

  updateTime: () ->

  exports:
    getDefaults: (courseId) ->

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

toIndexer = (courseId, tasking) ->
  identifiers = ["course#{courseId}"]

  unless _.isUndefined(tasking)
    if _.isString(tasking)
      # assume tasking is taskId
      tasking =
        target_id: tasking
        target_type: 'period'

    identifiers.push("#{tasking.target_type}#{tasking.target_id}")

  identifiers.join('.')


TaskingConfig =
  _defaults: {}
  _taskings: {}
