Corrected expId

This commit is contained in:
Thomas FORGIONE 2015-09-29 10:46:44 +02:00
parent a6594f5119
commit dfd9b8b3d9
2 changed files with 5 additions and 1 deletions

View File

@ -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,

View File

@ -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