mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-26 21:02:02 -04:00
Fixed submit date checks
This commit is contained in:
parent
7a670feefb
commit
8399667b49
1 changed files with 6 additions and 8 deletions
|
@ -84,7 +84,7 @@ module.exports.dispatchTaskToConsumer = (req, res) ->
|
|||
message.changeMessageVisibilityTimeout scoringTaskTimeoutInSeconds, (err) ->
|
||||
if err? then return errors.serverError res, "There was an error changing the message visibility timeout."
|
||||
console.log "Changed visibility timeout"
|
||||
constructTaskLogObject getUserIDFromRequest(req),messageBody.registrationTime, message.getReceiptHandle(), (taskLogError, taskLogObject) ->
|
||||
constructTaskLogObject getUserIDFromRequest(req), message.getReceiptHandle(), (taskLogError, taskLogObject) ->
|
||||
if taskLogError? then return errors.serverError res, "There was an error creating the task log object."
|
||||
|
||||
taskObject.taskID = taskLogObject._id
|
||||
|
@ -111,10 +111,9 @@ module.exports.processTaskResult = (req, res) ->
|
|||
LevelSession.findOne(_id: clientResponseObject.originalSessionID).lean().exec (err, levelSession) ->
|
||||
if err? then return errors.serverError res, "There was a problem finding the level session:#{err}"
|
||||
|
||||
console.log "Queue message created at: #{taskLogJSON.createdAt}, level session submitted at #{levelSession.submitDate}"
|
||||
|
||||
if taskLogJSON.registrationTime <= levelSession.submitDate
|
||||
console.log "Task has been resubmitted!"
|
||||
supposedSubmissionDate = new Date(clientResponseObject.sessions[0].submitDate)
|
||||
|
||||
if Number(supposedSubmissionDate) isnt Number(levelSession.submitDate)
|
||||
return sendResponseObject req, res, {"message":"The game has been resubmitted. Removing from queue..."}
|
||||
|
||||
logTaskComputation clientResponseObject, taskLog, (logErr) ->
|
||||
|
@ -333,7 +332,7 @@ generateTaskPairs = (submittedSessions, sessionToScore) ->
|
|||
return taskPairs
|
||||
|
||||
sendTaskPairToQueue = (taskPair, callback) ->
|
||||
scoringTaskQueue.sendMessage {sessions: taskPair, registrationTime:new Date()}, 0, (err,data) -> callback? err,data
|
||||
scoringTaskQueue.sendMessage {sessions: taskPair}, 0, (err,data) -> callback? err,data
|
||||
|
||||
getUserIDFromRequest = (req) -> if req.user? then return req.user._id else return null
|
||||
|
||||
|
@ -380,10 +379,9 @@ getSessionInformation = (sessionIDString, callback) ->
|
|||
callback err, sessionInformation
|
||||
|
||||
|
||||
constructTaskLogObject = (calculatorUserID, registrationTime, messageIdentifierString, callback) ->
|
||||
constructTaskLogObject = (calculatorUserID, messageIdentifierString, callback) ->
|
||||
taskLogObject = new TaskLog
|
||||
"createdAt": new Date()
|
||||
"registrationTime": registrationTime
|
||||
"calculator":calculatorUserID
|
||||
"sentDate": Date.now()
|
||||
"messageIdentifierString":messageIdentifierString
|
||||
|
|
Loading…
Add table
Reference in a new issue