Put in pairwise simulation button

This commit is contained in:
Michael Schmatz 2014-02-14 16:53:34 -08:00
parent fdf1e21e72
commit c418e282ae
3 changed files with 19 additions and 2 deletions
app
lib/simulator
templates/play
views/play

View file

@ -75,7 +75,7 @@ module.exports = class Simulator
type: "PUT"
success: @handleTaskResultsTransferSuccess
error: @handleTaskResultsTransferError
complete: @cleanupAndSimulateAnotherTask()
complete: @cleanupAndSimulateAnotherTask
handleTaskResultsTransferSuccess: (result) ->
console.log "Task registration result: #{JSON.stringify result}"

View file

@ -5,7 +5,9 @@ block content
h3= level.get('name')
div#level-description
!{description}
if me.isAdmin()
button.btn.btn-warning.btn-lg.highlight#simulate-button(style="margin-bottom:10px") Simulate all games
div#leaderboard-column
ul.nav.nav-pills
for team in teams

View file

@ -28,6 +28,21 @@ module.exports = class LadderView extends RootView
id: 'ladder-view'
template: require 'templates/play/ladder'
startsLoading: true
events:
'click #simulate-button': 'onSimulateButtonClick'
onSimulateButtonClick: (e) ->
submitIDs = _.pluck @leaderboards[@teams[0]].topPlayers.models, "id"
for ID in submitIDs
$.ajax
url: '/queue/scoring'
method: 'POST'
data:
session: ID
alert "Simulating all games!"
alert "(do not push more than once pls)"
constructor: (options, levelID) ->
super(options)