 DOMPurify = require 'dompurify'
 
 { STARTER_LICENSE_COURSE_IDS } = require 'core/constants'
+
+getLastSelectedCourseKey = (classroomId) -> 'selectedCourseId_' + classroomId + '_' + me.id
 
 module.exports = class TeacherClassView extends RootView
   id: 'teacher-class-view'

    @listenTo @courses, 'sync change update', ->
      @setCourseMembers() # Is this necessary?
      unless @state.get 'selectedCourse'
        @state.set 'selectedCourse', @courses.first()
      @setSelectedCourseInstance()
    @listenTo @courseInstances, 'sync change update', ->
      @setCourseMembers()

    @state.set('searchTerm', $(e.target).val())

  onChangeCourseSelect: (e) ->
    selectedCourseId = $(e.currentTarget).val()
    localStorage.setItem getLastSelectedCourseKey(this.classroom.id), selectedCourseId
    @trigger 'course-select:change', { selectedCourse: @courses.get(selectedCourseId) }

  onChangeLockedLevelSelect: (e) ->
    level = $(e.currentTarget).val()
