Worked around mongoose toObject

Also tried elementary memory leak fix
This commit is contained in:
Michael Schmatz 2014-02-13 17:10:01 -08:00
parent 4001d1c7fe
commit ca7376b794
2 changed files with 5 additions and 1 deletions
app/views
server/queues

View file

@ -146,7 +146,7 @@ module.exports = class HomeView extends View
status: "incomplete" status: "incomplete"
god.spells = @filterProgrammableComponents level.attributes.thangs, @generateSpellToSourceMap data.sessions god.spells = @filterProgrammableComponents level.attributes.thangs, @generateSpellToSourceMap data.sessions
god.createWorld() god.createWorld()
@god = god
Backbone.Mediator.subscribe 'god:new-world-created', @onWorldCreated, @ Backbone.Mediator.subscribe 'god:new-world-created', @onWorldCreated, @
onWorldCreated: (data) -> onWorldCreated: (data) ->
@ -154,6 +154,8 @@ module.exports = class HomeView extends View
taskResults = @translateGoalStatesIntoTaskResults data.goalStates taskResults = @translateGoalStatesIntoTaskResults data.goalStates
console.log "Task Results" console.log "Task Results"
console.log taskResults console.log taskResults
@god?.destroy()
$.ajax $.ajax
url: "/queue/scoring" url: "/queue/scoring"
data: taskResults data: taskResults

View file

@ -227,6 +227,7 @@ updateScoreInSession = (scoreObject,callback) ->
LevelSession.findOne sessionObjectQuery, (err, session) -> LevelSession.findOne sessionObjectQuery, (err, session) ->
return callback err, null if err? return callback err, null if err?
session = session.toObject()
updateObject = updateObject =
meanStrength: scoreObject.meanStrength meanStrength: scoreObject.meanStrength
standardDeviation: scoreObject.standardDeviation standardDeviation: scoreObject.standardDeviation
@ -250,6 +251,7 @@ retrieveOldScoreMetrics = (sessionID, callback) ->
LevelSession.findOne sessionQuery, (err, session) -> LevelSession.findOne sessionQuery, (err, session) ->
return callback err, {"error":"There was an error retrieving the session."} if err? return callback err, {"error":"There was an error retrieving the session."} if err?
session = session.toObject()
defaultScore = (25 - 1.8*(25/3)) defaultScore = (25 - 1.8*(25/3))
defaultStandardDeviation = 25/3 defaultStandardDeviation = 25/3