     if eventChannel.event is 'validated.failure'
       if includes(map(data, 'code'), 'course_ended')
         @setState(isEnrollmentTargetPast: true)
-        if @getUser().getCourse(@props.collectionUUID).id is @getUser().getCourse(@props.collectionUUID, @props.enrollmentCode)?.id
-          @setState(isCoursePast: true)
     else if eventChannel.event is 'validated.success'
       @props.setIsEnrollmentCodeValid?(true)
       @setState(isEnrollmentCodeValid: true)

    if @props.enrollmentCode? and not @getUser().isEnrolled(@props.collectionUUID, @props.enrollmentCode)
      @validateEnrollmentCode()

  _onUserChange: ->
    @setState(isCoursePast: @getCourse().getWhen() is 'past')
    true

  validateEnrollmentCode: ->
    {enrollmentCode} = @props
    course = @getCourse()
    course.channel.once('validated.*', partial(@setIsEnrollmentCodeValid, course.channel))
    course.validate(enrollmentCode)


    height: @getHeight()
    isEnrollmentCodeValid: false
    isEnrollmentTargetPast: false
    isCoursePast: @getCurrentCourse()?.getWhen() is 'past'

  componentWillReceiveProps: (nextProps) ->
    @setState(height: @getHeight(nextProps)) if @props.isLaunching isnt nextProps.isLaunching
