diff --git a/server/levels/sessions/level_session_schema.coffee b/server/levels/sessions/level_session_schema.coffee index 4073d25ef..a21c02844 100644 --- a/server/levels/sessions/level_session_schema.coffee +++ b/server/levels/sessions/level_session_schema.coffee @@ -100,8 +100,8 @@ _.extend LevelSessionSchema.properties, type: 'object' source: type: 'string' - - # TODO: specify this more + +# TODO: specify this more code: type: 'object' @@ -134,6 +134,45 @@ _.extend LevelSessionSchema.properties, default: false index:true + submitDate: + type: c.date + title: 'Submitted' + + submittedCode: + type: 'object' + + matches: + type: 'array' + items: + type: 'object' + properties: + date: c.date + title: 'Time' + metrics: + type: 'object' + properties: + rank: + type: 'number' + opponents: + type: 'array' + items: + type: 'object' + properties: + id: + type: ['object', 'string'] + codeSubmitDate: c.date + title: 'Submitted' + metrics: + type: 'object' + properties: + rank: + type: 'number' + + + + + + c.extendBasicProperties LevelSessionSchema, 'level.session' c.extendPermissionsProperties LevelSessionSchema, 'level.session' diff --git a/server/queues/scoring.coffee b/server/queues/scoring.coffee index 5607d0ae8..48eb6f5e8 100644 --- a/server/queues/scoring.coffee +++ b/server/queues/scoring.coffee @@ -174,7 +174,7 @@ module.exports.processTaskResult = (req, res) -> if loggingError? return errors.serverError res, "There as a problem logging the task computation: #{loggingError}" - updateScores clientResponseObject, (updatingScoresError, newScores) -> + updateSessions clientResponseObject, (updatingScoresError, newScores) -> if updatingScoresError? return errors.serverError res, "There was an error updating the scores.#{updatingScoresError}" @@ -204,10 +204,10 @@ logTaskComputation = (taskObject,taskLogObject, callback) -> taskLogObject.save callback -updateScores = (taskObject,callback) -> +updateSessions = (taskObject,callback) -> sessionIDs = _.pluck taskObject.sessions, 'sessionID' - async.map sessionIDs, retrieveOldScoreMetrics, (err, oldScores) -> + async.map sessionIDs, retrieveOldSessionData, (err, oldScores) -> callback err, {"error": "There was an error retrieving the old scores"} if err? oldScoreArray = _.toArray putRankingFromMetricsIntoScoreObject taskObject, oldScores @@ -245,7 +245,7 @@ putRankingFromMetricsIntoScoreObject = (taskObject,scoreObject) -> scoreObject -retrieveOldScoreMetrics = (sessionID, callback) -> +retrieveOldSessionData = (sessionID, callback) -> sessionQuery = "_id":sessionID