mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Added continuous simulation and fix for "no team"
This commit is contained in:
parent
9bea226677
commit
d33c39c21e
2 changed files with 6 additions and 2 deletions
|
@ -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) =>
|
||||
|
|
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue