Live leaderboard updating

This commit is contained in:
Michael Schmatz 2014-03-03 12:10:24 -08:00
parent 1efb96f24a
commit a5864c4f0c
2 changed files with 16 additions and 1 deletions

View file

@ -14,6 +14,9 @@ module.exports = class MyMatchesTabView extends CocoView
constructor: (options, @level, @sessions) ->
super(options)
@refreshMatches()
refreshMatches: ->
@teams = teamDataFromLevel @level
@nameMap = {}
@loadNames()
@ -82,6 +85,7 @@ module.exports = class MyMatchesTabView extends CocoView
c1 and not _.isEqual(c1, c2)
rankSession: (e) ->
console.log "Clicked"
button = $(e.target).closest('.rank-button')
sessionID = button.data('session-id')
session = _.find @sessions.models, { id: sessionID }

View file

@ -64,7 +64,18 @@ module.exports = class LadderView extends RootView
return if @startsLoading
@insertSubView(@ladderTab = new LadderTabView({}, @level, @sessions))
@insertSubView(@myMatchesTab = new MyMatchesTabView({}, @level, @sessions))
setInterval(@fetchSessionsAndRefreshViews.bind(@), 10000)
fetchSessionsAndRefreshViews: ->
@sessions.fetch({"success": @refreshViews})
refreshViews: =>
@ladderTab.constructor({}, @level, @sessions)
@myMatchesTab.refreshMatches()
console.log "refreshed views!"
# Simulations
onSimulateAllButtonClick: (e) ->