From ca7376b794c645f47ad94d8fed4d1de958f6c0cb Mon Sep 17 00:00:00 2001 From: Michael Schmatz Date: Thu, 13 Feb 2014 17:10:01 -0800 Subject: [PATCH] Worked around mongoose toObject Also tried elementary memory leak fix --- app/views/home_view.coffee | 4 +++- server/queues/scoring.coffee | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/home_view.coffee b/app/views/home_view.coffee index 42768929d..50f20db8c 100644 --- a/app/views/home_view.coffee +++ b/app/views/home_view.coffee @@ -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 diff --git a/server/queues/scoring.coffee b/server/queues/scoring.coffee index 80e1525f9..2c98b4c19 100644 --- a/server/queues/scoring.coffee +++ b/server/queues/scoring.coffee @@ -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