   constructor: (options, @level, @sessions) ->
     super(options)
     @refreshMatches()
-    
+
   refreshMatches: ->
     @teams = teamDataFromLevel @level
     @nameMap = {}

    @setRankingButtonText(button, 'ranking')
    success = => @setRankingButtonText(button, 'ranked')
    failure = => @setRankingButtonText(button, 'failed')
    
    ajaxData = { session: sessionID, levelID: @level.id, originalLevelID: @level.attributes.original, levelMajorVersion: @level.attributes.version.major }
    $.ajax '/queue/scoring', {
      type: 'POST'

      @setRankingButtonText button, if @readyToRank(session) then 'rank' else 'unavailable'

  readyToRank: (session) ->
    return false unless session?.get('levelID')  # If it hasn't been denormalized, then it's not ready.
    c1 = session?.get('code')
    c2 = session?.get('submittedCode')
    c1 and not _.isEqual(c1, c2)
