Added continuous simulation and fix for "no team"

This commit is contained in:
Michael Schmatz 2014-02-13 15:59:37 -08:00
parent 9bea226677
commit d33c39c21e
2 changed files with 6 additions and 2 deletions

View file

@ -106,11 +106,14 @@ module.exports = class HomeView extends View
onSimulateButtonClick: (e) =>
@alreadyPostedResults = false
console.log "Simulating world!"
$.ajax
url: "/queue/scoring"
type: "GET"
error: (data) =>
console.log "There are no games to score. Error: #{data}"
console.log "There are no games to score. Error: #{JSON.stringify data}"
console.log "Retrying in ten seconds..."
_.delay @onSimulateButtonClick, 10000
success: (data) =>
console.log data
levelName = data.sessions[0].levelID
@ -161,6 +164,7 @@ module.exports = class HomeView extends View
console.log "TASK REGISTRATION ERROR:#{JSON.stringify error}"
complete: (result) =>
@alreadyPostedResults = true
@onSimulateButtonClick()
translateGoalStatesIntoTaskResults: (goalStates) =>

View file

@ -40,7 +40,7 @@ module.exports.createNewTask = (req, res) ->
LevelSession.find { "levelID": "project-dota", "submitted": true}, (err, submittedSessions) ->
taskPairs = []
for session in submittedSessions
if String(session._id) isnt req.body.session and session.team isnt sessionToScore.team
if String(session._id) isnt req.body.session and session.team isnt sessionToScore.team and session.team in ["ogres","humans"]
taskPairs.push [req.body.session,String session._id]
async.each taskPairs, sendTaskPairToQueue, (taskPairError) ->
return errors.serverError res, "There was an error sending the task pairs to the queue" if taskPairError?