 {CrudConfig, makeSimpleStore, extendConfig} = require './helpers'
 _ = require 'underscore'
 
-SAVING = 'saving'
+LOADED  = 'loaded'
 
 RosterConfig = {
 

    @_local[courseId].push(student)
    @emitChange()

  save: (courseId, studentId, params) ->
    @_asyncStatus[studentId] = SAVING
    @emitChange()

  saved: (newProps, studentId) ->
    # update the student from all the courses rosters
    for courseId, roster of @_local
      students = roster.students

    getActiveStudentsForPeriod: (courseId, periodId) ->
      _.where(@_get(courseId).students, period_id: periodId, is_active: true)

}

extendConfig(RosterConfig, new CrudConfig())
