diff --git a/app/views/play/ladder/my_matches_tab.coffee b/app/views/play/ladder/my_matches_tab.coffee index f4994d519..00aec7c8c 100644 --- a/app/views/play/ladder/my_matches_tab.coffee +++ b/app/views/play/ladder/my_matches_tab.coffee @@ -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 } diff --git a/app/views/play/ladder_view.coffee b/app/views/play/ladder_view.coffee index b1d74b182..bc4f0fd6d 100644 --- a/app/views/play/ladder_view.coffee +++ b/app/views/play/ladder_view.coffee @@ -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) ->