mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -04:00
Add temp error handling for updateSessions
This commit is contained in:
parent
88ef5ffe93
commit
a6352c214a
1 changed files with 7 additions and 5 deletions
|
@ -439,6 +439,7 @@ verifyClientResponse = (responseObject, callback) ->
|
|||
callback "The response to that query is required to be a JSON object."
|
||||
else
|
||||
@clientResponseObject = responseObject
|
||||
|
||||
#log.info "Verified client response!"
|
||||
callback null, responseObject
|
||||
|
||||
|
@ -497,11 +498,12 @@ updateSessions = (callback) ->
|
|||
|
||||
async.map sessionIDs, retrieveOldSessionData, (err, oldScores) =>
|
||||
if err? then callback err, {"error": "There was an error retrieving the old scores"}
|
||||
|
||||
oldScoreArray = _.toArray putRankingFromMetricsIntoScoreObject @clientResponseObject, oldScores
|
||||
newScoreArray = bayes.updatePlayerSkills oldScoreArray
|
||||
saveNewScoresToDatabase newScoreArray, callback
|
||||
|
||||
try
|
||||
oldScoreArray = _.toArray putRankingFromMetricsIntoScoreObject @clientResponseObject, oldScores
|
||||
newScoreArray = bayes.updatePlayerSkills oldScoreArray
|
||||
saveNewScoresToDatabase newScoreArray, callback
|
||||
catch e
|
||||
callback e
|
||||
|
||||
saveNewScoresToDatabase = (newScoreArray, callback) ->
|
||||
async.eachSeries newScoreArray, updateScoreInSession, (err) ->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue