From d6b45ab85b1bc4721f7fdb28d2b2b5468be3f685 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Thu, 4 Jun 2015 17:08:52 +0200 Subject: [PATCH] Corrected SQL mistake and improved replay index --- controllers/prototype/dbrequests.js | 8 +++----- controllers/prototype/views/replay_index.jade | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/controllers/prototype/dbrequests.js b/controllers/prototype/dbrequests.js index 62894bf..3fa5193 100644 --- a/controllers/prototype/dbrequests.js +++ b/controllers/prototype/dbrequests.js @@ -295,8 +295,6 @@ ExpCreator.prototype.execute = function() { "INSERT INTO experiment(user_id, scene_id) VALUES(" + this.user_id + " , 1); SELECT currval('experiment_id_seq');", [], function(err, result) { - console.log(self.user_id); - console.log(err); self.finalResult = result.rows[0].currval; self.finish(); } @@ -392,13 +390,13 @@ ExpGetter.prototype.execute = function() { "SELECT " + "experiment.id as exp_id, " + "users.name as username, " + - "scene.name as scenename " + + "scene.name as scenename, " + + "users.id as user_id " + "FROM experiment, users, scene " + - "WHERE experiment.user_id = user_id and scene.id = experiment.scene_id " + + "WHERE experiment.user_id = users.id and scene.id = experiment.scene_id " + "ORDER BY experiment.id;", [], function(err, result) { - console.log(err); self.finalResult = result.rows; self.finish(); } diff --git a/controllers/prototype/views/replay_index.jade b/controllers/prototype/views/replay_index.jade index c33f98b..7736cd3 100644 --- a/controllers/prototype/views/replay_index.jade +++ b/controllers/prototype/views/replay_index.jade @@ -10,4 +10,4 @@ block content else ol each elt in users - li User #{elt.username} for scene #{elt.scenename} + li User #{elt.username} (#{elt.user_id}) for scene #{elt.scenename}