mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -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) =>
|
onSimulateButtonClick: (e) =>
|
||||||
@alreadyPostedResults = false
|
@alreadyPostedResults = false
|
||||||
|
console.log "Simulating world!"
|
||||||
$.ajax
|
$.ajax
|
||||||
url: "/queue/scoring"
|
url: "/queue/scoring"
|
||||||
type: "GET"
|
type: "GET"
|
||||||
error: (data) =>
|
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) =>
|
success: (data) =>
|
||||||
console.log data
|
console.log data
|
||||||
levelName = data.sessions[0].levelID
|
levelName = data.sessions[0].levelID
|
||||||
|
@ -161,6 +164,7 @@ module.exports = class HomeView extends View
|
||||||
console.log "TASK REGISTRATION ERROR:#{JSON.stringify error}"
|
console.log "TASK REGISTRATION ERROR:#{JSON.stringify error}"
|
||||||
complete: (result) =>
|
complete: (result) =>
|
||||||
@alreadyPostedResults = true
|
@alreadyPostedResults = true
|
||||||
|
@onSimulateButtonClick()
|
||||||
|
|
||||||
|
|
||||||
translateGoalStatesIntoTaskResults: (goalStates) =>
|
translateGoalStatesIntoTaskResults: (goalStates) =>
|
||||||
|
|
|
@ -40,7 +40,7 @@ module.exports.createNewTask = (req, res) ->
|
||||||
LevelSession.find { "levelID": "project-dota", "submitted": true}, (err, submittedSessions) ->
|
LevelSession.find { "levelID": "project-dota", "submitted": true}, (err, submittedSessions) ->
|
||||||
taskPairs = []
|
taskPairs = []
|
||||||
for session in submittedSessions
|
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]
|
taskPairs.push [req.body.session,String session._id]
|
||||||
async.each taskPairs, sendTaskPairToQueue, (taskPairError) ->
|
async.each taskPairs, sendTaskPairToQueue, (taskPairError) ->
|
||||||
return errors.serverError res, "There was an error sending the task pairs to the queue" if taskPairError?
|
return errors.serverError res, "There was an error sending the task pairs to the queue" if taskPairError?
|
||||||
|
|
Loading…
Reference in a new issue