mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 10:06:08 -05:00
Merge branch 'master' of https://github.com/codecombat/codecombat
This commit is contained in:
commit
3d308f03dc
2 changed files with 25 additions and 0 deletions
|
@ -77,6 +77,27 @@ module.exports.resimulateAllSessions = (req, res) ->
|
||||||
async.each result, resimulateSession.bind(@,originalLevelID,levelMajorVersion), (err) ->
|
async.each result, resimulateSession.bind(@,originalLevelID,levelMajorVersion), (err) ->
|
||||||
if err? then return errors.serverError res, err
|
if err? then return errors.serverError res, err
|
||||||
sendResponseObject req, res, {"message":"All task pairs were succesfully sent to the queue"}
|
sendResponseObject req, res, {"message":"All task pairs were succesfully sent to the queue"}
|
||||||
|
|
||||||
|
resimulateSession = (originalLevelID, levelMajorVersion, session, cb) =>
|
||||||
|
sessionUpdateObject =
|
||||||
|
submitted: true
|
||||||
|
submitDate: new Date()
|
||||||
|
meanStrength: 25
|
||||||
|
standardDeviation: 25/3
|
||||||
|
totalScore: 10
|
||||||
|
numberOfWinsAndTies: 0
|
||||||
|
numberOfLosses: 0
|
||||||
|
isRanking: true
|
||||||
|
LevelSession.update {_id: session._id}, sessionUpdateObject, (err, updatedSession) ->
|
||||||
|
if err? then return cb err, null
|
||||||
|
opposingTeam = calculateOpposingTeam(session.team)
|
||||||
|
fetchInitialSessionsToRankAgainst opposingTeam, originalLevelID, levelMajorVersion, (err, sessionsToRankAgainst) ->
|
||||||
|
if err? then return cb err, null
|
||||||
|
|
||||||
|
taskPairs = generateTaskPairs(sessionsToRankAgainst, session)
|
||||||
|
sendEachTaskPairToTheQueue taskPairs, (taskPairError) ->
|
||||||
|
if taskPairError? then return cb taskPairError, null
|
||||||
|
cb null
|
||||||
|
|
||||||
|
|
||||||
module.exports.createNewTask = (req, res) ->
|
module.exports.createNewTask = (req, res) ->
|
||||||
|
|
|
@ -14,6 +14,10 @@ module.exports.setup = (app) ->
|
||||||
handler = loadQueueHandler 'scoring'
|
handler = loadQueueHandler 'scoring'
|
||||||
handler.messagesInQueueCount req, res
|
handler.messagesInQueueCount req, res
|
||||||
|
|
||||||
|
app.post '/queue/scoring/resimulateAllSessions', (req, res) ->
|
||||||
|
handler = loadQueueHandler 'scoring'
|
||||||
|
handler.resimulateAllSessions req, res
|
||||||
|
|
||||||
|
|
||||||
app.all '/queue/*', (req, res) ->
|
app.all '/queue/*', (req, res) ->
|
||||||
setResponseHeaderToJSONContentType res
|
setResponseHeaderToJSONContentType res
|
||||||
|
|
Loading…
Reference in a new issue