Created checker interface
This commit is contained in:
7
controllers/prototype/dbrequests.js
vendored
7
controllers/prototype/dbrequests.js
vendored
@@ -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) {
|
||||
|
||||
26
controllers/prototype/index.js
vendored
26
controllers/prototype/index.js
vendored
@@ -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');
|
||||
|
||||
|
||||
1
controllers/prototype/urls.js
vendored
1
controllers/prototype/urls.js
vendored
@@ -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'
|
||||
};
|
||||
|
||||
15
controllers/prototype/views/prototype_checker.jade
Normal file
15
controllers/prototype/views/prototype_checker.jade
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user