From dfd9b8b3d9cfea58d6e531defd099371d02cd13f Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 29 Sep 2015 10:46:44 +0200 Subject: [PATCH] Corrected expId --- controllers/prototype/dbrequests.js | 3 +++ controllers/prototype/index.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/prototype/dbrequests.js b/controllers/prototype/dbrequests.js index 744495a..b7076dd 100644 --- a/controllers/prototype/dbrequests.js +++ b/controllers/prototype/dbrequests.js @@ -1008,6 +1008,7 @@ DBReq.LastExpGetter.prototype.execute = function() { ' coin_7, \n' + ' coin_8, \n' + ' Experiment.recommendation_style AS "recommendationStyle", \n' + + ' Experiment.id AS "expId", \n' + ' CoinCombination.id as "coinCombinationId" \n' + 'FROM Experiment, CoinCombination \n' + 'WHERE Experiment.coin_combination_id = CoinCombination.id \n' + @@ -1038,6 +1039,7 @@ DBReq.LastExpGetter.prototype.execute = function() { result.rows[0].coin_8 ]; self.finalResult.coinCombinationId = result.rows[0].coinCombinationId; + self.finalResult.expId = result.rows[0].expId; self.finish(); } ); @@ -1049,6 +1051,7 @@ DBReq.LastExpGetter.prototype.finish = function() { this.release = null; this.finishAction( + this.finalResult.expId, this.finalResult.sceneId, this.finalResult.coinCombinationId, this.finalResult.recommendationStyle, diff --git a/controllers/prototype/index.js b/controllers/prototype/index.js index c0defdb..3b325dd 100644 --- a/controllers/prototype/index.js +++ b/controllers/prototype/index.js @@ -79,7 +79,7 @@ module.exports.play = function(req, res) { req.session.experiments = req.session.experiments || []; - db.getLastExp(req.session.userId, function(sceneId, coinId, recoStyle, coins) { + db.getLastExp(req.session.userId, function(expId, sceneId, coinId, recoStyle, coins) { res.locals.scene = sceneToFunction(sceneId); res.locals.recommendationStyle= recoStyle; @@ -91,6 +91,7 @@ module.exports.play = function(req, res) { coinCombinationId : coinId }); + req.session.expId = expId; req.session.save(); // Prepare next experiment