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

View file

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

View file

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