A lot of stuff, I'm completely lost 😢

This commit is contained in:
Thomas FORGIONE
2015-10-26 15:56:18 +01:00
parent 8ed2b18d49
commit 4768a3056c
14 changed files with 274 additions and 96 deletions
+29 -1
View File
@@ -96,7 +96,8 @@ DBReq.Info = function(id, finishAction) {
hovered: false,
pointerLocked: false,
switchedLockOption: false,
redCoins: false
redCoins: false,
sceneInfo: false
};
/**
@@ -150,6 +151,7 @@ DBReq.Info.prototype.execute = function() {
this.loadSwitchedLockOption();
this.loadPointerLocked();
this.loadRedCoins();
this.loadSceneInfo();
};
/**
@@ -209,6 +211,8 @@ DBReq.Info.prototype.merge = function() {
for (i = 0; i < this.redCoins.length; i++) {
this.finalResult.redCoins.push(this.redCoins[i]);
}
this.finalResult.sceneInfo = this.sceneInfo;
};
/**
@@ -529,6 +533,30 @@ DBReq.Info.prototype.loadRedCoins = function() {
);
};
DBReq.Info.prototype.loadSceneInfo = function() {
var self = this;
this.client.query(
'SELECT Experiment.recommendation_style AS "recommendationStyle", \n' +
' CoinCombination.scene_id AS "sceneId" \n' +
'FROM Experiment, CoinCombination \n' +
'WHERE Experiment.coin_combination_id = CoinCombination.id AND Experiment.id = $1;',
[self.id],
function(err, result) {
if (err !== null) {
Log.dberror(err + ' in loadSceneInfo');
console.log(err);
} else {
self.sceneInfo = {
recommendationStyle : result.rows[0].recommendationStyle,
sceneId : result.rows[0].sceneId
};
}
self.ready.sceneInfo = true;
self.tryMerge();
}
);
};
/**
* Class that creates a user
* @param workerId {string} the name of the person doing the experiment