Created checker interface

This commit is contained in:
Thomas FORGIONE
2015-08-24 17:13:14 +02:00
parent 4dfd241064
commit 25d6d3a89a
6 changed files with 330 additions and 4 deletions

View File

@@ -834,7 +834,7 @@ DBReq.ExpIdChecker = function(id, finishAction) {
DBReq.ExpIdChecker.prototype.execute = function() {
var self = this;
this.client.query(
"SELECT scene_id FROM experiment WHERE id = $1;",
"SELECT scene_id FROM experiment, CoinCombination WHERE CoinCombination.id = Experiment.coin_combination_id AND Experiment.id = $1;",
[self.id],
function(err, result) {
if (result === undefined || result.rows.length === 0) {
@@ -888,8 +888,9 @@ DBReq.ExpGetter.prototype.execute = function() {
"users.worker_id as username, " +
"scene.name as scenename, " +
"users.id as user_id " +
"FROM experiment, users, scene " +
"WHERE experiment.user_id = users.id and scene.id = experiment.scene_id " +
"FROM experiment, users, scene, CoinCombination " +
"WHERE experiment.user_id = users.id and scene.id = CoinCombination.scene_id AND " +
" Experiment.coin_combination_id = CoinCombination.id " +
"ORDER BY experiment.id;",
[],
function(err, result) {

View File

@@ -239,6 +239,32 @@ module.exports.viewer = function(req, res, next) {
};
module.exports.checker = function(req, res, next) {
var scene = req.params.scene;
switch (scene) {
case 'peach': res.locals.scene = "L3D.initPeach"; break;
case 'coolcoolmountain': res.locals.scene = "L3D.initMountain"; break;
case 'whomp': res.locals.scene = "L3D.initWhomp"; break;
case 'bobomb': res.locals.scene = "L3D.initBobomb"; break;
default:
// 404
var err = new Error('Incorrect scene');
err.status = 404;
next(err);
break;
}
res.setHeader('Content-Type', 'text/html');
res.render('prototype_checker.jade', res.locals, function(err, result) {
res.send(result);
});
};
module.exports.userstudy = function(req, res) {
res.setHeader('Content-Type', 'text/html');

View File

@@ -8,5 +8,6 @@ module.exports = {
'/prototype/sponza': 'sponza',
'/prototype/coin-creator/:scene': 'clicker',
'/prototype/coin-viewer/:scene': 'viewer',
'/prototype/coin-checker/:scene': 'checker',
'/user-study': 'userstudy'
};

View File

@@ -0,0 +1,15 @@
extends ./prototype
block title
title #{title} - Prototype
block mainjs
script initMainScene = #{scene};
script Recommendation = L3D.ArrowRecommendation;
script(src="/static/js/coinchecker.min.js")
block extrabutton
//-button#save.btn.btn-primary.navbar-btn(style={'margin-right': '10px', 'margin-bottom':'10px'}, onclick="saveCoins();") Save coins
button#coins-remaining.btn.btn-primary.navbar-btn(style={'margin-right':'10px', 'margin-bottom':'10px'}) Lol coins remaining