diff --git a/controllers/prototype/dbrequests.js b/controllers/prototype/dbrequests.js index 86e96a7..649f0b9 100644 --- a/controllers/prototype/dbrequests.js +++ b/controllers/prototype/dbrequests.js @@ -453,15 +453,30 @@ DBReq.Info.prototype.loadSwitchedLockOption = function() { DBReq.Info.prototype.loadRedCoins = function() { var self = this; this.client.query( - "SELECT coin_id FROM coin WHERE exp_id = $1", + "SELECT coin_1, \n" + + " coin_2, \n" + + " coin_3, \n" + + " coin_4, \n" + + " coin_5, \n" + + " coin_6, \n" + + " coin_7, \n" + + " coin_8 \n" + + "FROM CoinCombination, Experiment \n" + + "WHERE CoinCombination.id = Experiment.coin_combination_id AND \n" + + " Experiment.id = $1;", [self.id], function(err, result) { if (err !== null) { Log.dberror(err + ' in loadRedCoins'); } else { - for (var i in result.rows) { - self.redCoins.push(result.rows[i].coin_id); - } + self.redCoins.push(result.rows[0].coin_1); + self.redCoins.push(result.rows[0].coin_2); + self.redCoins.push(result.rows[0].coin_3); + self.redCoins.push(result.rows[0].coin_4); + self.redCoins.push(result.rows[0].coin_5); + self.redCoins.push(result.rows[0].coin_6); + self.redCoins.push(result.rows[0].coin_7); + self.redCoins.push(result.rows[0].coin_8); } self.ready.redCoins = true; self.tryMerge(); diff --git a/controllers/thankyou/views/index.jade b/controllers/thankyou/views/index.jade index 013254a..821cda0 100644 --- a/controllers/thankyou/views/index.jade +++ b/controllers/thankyou/views/index.jade @@ -2,4 +2,7 @@ extends ../../../views/base.jade block content h1 Thank you for everything ! + audio(autoplay) + source(src="/static/data/music/thankyou.ogg") + source(src="/static/data/music/thankyou.mp3") diff --git a/js/l3d/apps/prototype/coin-checker/main.js b/js/l3d/apps/prototype/coin-checker/main.js index 3ef94e6..2ac0952 100644 --- a/js/l3d/apps/prototype/coin-checker/main.js +++ b/js/l3d/apps/prototype/coin-checker/main.js @@ -48,6 +48,8 @@ saveCoins = function() { }; function main() { + // Some config + L3D.DB.disable(); // Main container that holds everything container = document.getElementById('container'); @@ -63,9 +65,6 @@ function main() { // Set the good size of cameras onWindowResize(); - // Some config - L3D.DB.disable(); - Coin.update(); startCanvas.render(L3D.StartCanvas.Black); diff --git a/js/l3d/apps/prototype/replay/main.js b/js/l3d/apps/prototype/replay/main.js index 00381d5..da4fbde 100644 --- a/js/l3d/apps/prototype/replay/main.js +++ b/js/l3d/apps/prototype/replay/main.js @@ -43,6 +43,11 @@ function initThreeElements() { function init(data) { + console.log(data); + + // Some config + L3D.DB.disable(); + // Initialize stats counter stats = new Stats(); stats.setMode(0); diff --git a/js/l3d/src/scenes/initScene.js b/js/l3d/src/scenes/initScene.js index 3bef1c2..b63faa6 100644 --- a/js/l3d/src/scenes/initScene.js +++ b/js/l3d/src/scenes/initScene.js @@ -261,9 +261,6 @@ L3D.generateCoins = function(totalCoins, coin_ids) { indices.push(totalCoins[i].id); } - if (coin_ids === undefined || (coin_ids instanceof Array && coin_ids.length === 0)) - L3D.DB.Private.sendData('/posts/coin-id', {indices : indices}); - return coins; }; diff --git a/posts/coin-id/index.js b/posts/coin-id/index.js deleted file mode 100644 index bf886bc..0000000 --- a/posts/coin-id/index.js +++ /dev/null @@ -1,32 +0,0 @@ -var pg = require('pg'); -var secret = require('../../private'); -var Log = require('../../lib/NodeLog.js'); - -function insertCoinId(client, release, exp_id, coin_ids) { - - if (coin_ids.length > 0) { - client.query( - 'INSERT INTO Coin(exp_id, coin_id) VALUES ($1, $2);', - [exp_id,coin_ids.shift()], - function(err, result) { - if (err !== null) - Log.dberror(err + ' coin-id'); - - if (coin_ids.length === 0) - release(); - else - insertCoinId(client, release, exp_id, coin_ids); - } - ); - } -} - -module.exports.index = function(req, res) { - - pg.connect(secret.url, function(err, client, release) { - insertCoinId(client, release, req.session.exp_id, req.body.indices); - }); - - res.setHeader('Content-Type', 'text/html'); - res.send(""); -}; diff --git a/posts/coin-id/urls.js b/posts/coin-id/urls.js deleted file mode 100644 index 4b3a708..0000000 --- a/posts/coin-id/urls.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - '/posts/coin-id': 'index' -}; diff --git a/sql/backup.pgsql b/sql/backup.pgsql index 556a49f..ed2e945 100644 --- a/sql/backup.pgsql +++ b/sql/backup.pgsql @@ -76,11 +76,6 @@ CREATE TABLE Experiment( recommendation_style VARCHAR(30) ); -CREATE TABLE Coin( - exp_id SERIAL REFERENCES Experiment (id), - coin_id INTEGER -); - -- Init scene table INSERT INTO Scene(name, coin_number) VALUES ('peachcastle' , 41); INSERT INTO Scene(name, coin_number) VALUES ('bobomb' , 44); diff --git a/static/data/music/thankyou.mp3 b/static/data/music/thankyou.mp3 new file mode 100644 index 0000000..b31de79 Binary files /dev/null and b/static/data/music/thankyou.mp3 differ diff --git a/static/data/music/thankyou.ogg b/static/data/music/thankyou.ogg new file mode 100644 index 0000000..b94cca3 Binary files /dev/null and b/static/data/music/thankyou.ogg differ