Corrected tutorial bugs
This commit is contained in:
parent
5f40dea529
commit
fb56153b4d
|
@ -2,7 +2,6 @@ module.exports.index = function(req, res) {
|
|||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
res.render('index.jade', res.locals, function(err, result) {
|
||||
console.log(err);
|
||||
res.send(result);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -581,7 +581,6 @@ DBReq.ExpCreator.prototype.execute = function() {
|
|||
"LIMIT 1;",
|
||||
[self.user_id],
|
||||
function(err, result) {
|
||||
console.log(result.rows);
|
||||
if (result.rows.length > 0) {
|
||||
// Set the result
|
||||
self.finalResult.coin_combination_id = result.rows[0].id;
|
||||
|
@ -904,6 +903,7 @@ DBReq.ExpGetter.prototype.finish = function() {
|
|||
DBReq.TutorialCreator = function(id, finishAction) {
|
||||
this.id = id;
|
||||
this.finishAction = finishAction;
|
||||
this.finalResult = {};
|
||||
|
||||
var self = this;
|
||||
pg.connect(pgc.url, function(err, client, release) {
|
||||
|
@ -924,11 +924,10 @@ DBReq.TutorialCreator.prototype.execute = function() {
|
|||
"LIMIT 8;",
|
||||
[],
|
||||
function(err, result) {
|
||||
self.coins = [];
|
||||
self.finalResult.coins = [];
|
||||
for (var i = 0; i < 8; i++) {
|
||||
self.coins.push(result.rows[i].id);
|
||||
self.finalResult.coins.push(result.rows[i].id);
|
||||
}
|
||||
|
||||
// Create CoinCombination
|
||||
self.client.query(
|
||||
"INSERT INTO CoinCombination(scene_id, coin_1, coin_2, coin_3, coin_4, coin_5, coin_6, coin_7, coin_8)\n" +
|
||||
|
@ -953,8 +952,7 @@ DBReq.TutorialCreator.prototype.execute = function() {
|
|||
"RETURNING id;",
|
||||
[self.id, result.rows[0].id],
|
||||
function(err, result) {
|
||||
console.log(err);
|
||||
self.finalResult = result.rows[0].id;
|
||||
self.finalResult.expId = result.rows[0].id;
|
||||
self.finish();
|
||||
}
|
||||
);
|
||||
|
@ -969,7 +967,7 @@ DBReq.TutorialCreator.prototype.finish = function() {
|
|||
this.release = null;
|
||||
this.client = null;
|
||||
|
||||
this.finishAction(this.finalResult);
|
||||
this.finishAction(this.finalResult.expId, this.finalResult.coins);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -173,8 +173,9 @@ module.exports.tutorial = function(req, res) {
|
|||
req.session.user_id = id;
|
||||
|
||||
// 1 is the ID of peach scene
|
||||
db.createTutorial(id, function(id) {
|
||||
db.createTutorial(id, function(id, coins) {
|
||||
req.session.exp_id = id;
|
||||
res.locals.coins = coins;
|
||||
req.session.save();
|
||||
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
|
|
|
@ -7,7 +7,7 @@ block title
|
|||
title #{title} - Prototype - Tutorial
|
||||
|
||||
block configjs
|
||||
script Recommendation = L3D.ArrowRecommendation;
|
||||
script Recommendation = L3D.ArrowRecommendation; coinsId = [#{coins}];
|
||||
script(src="/static/js/tutorial.min.js")
|
||||
|
||||
block lastbutton
|
||||
|
|
|
@ -20,7 +20,6 @@ block extrajs
|
|||
$('#form').submit(function(e) {
|
||||
e.preventDefault();
|
||||
var val = filterInt(document.getElementById('num').value);
|
||||
console.log(val);
|
||||
window.location.href = "/stream/" + val;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@ module.exports.index = function(req, res) {
|
|||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
res.render('index.jade', res.locals, function(err, result) {
|
||||
console.log(err);
|
||||
res.send(result);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -255,9 +255,7 @@ L3D.generateCoins = function(totalCoins, coin_ids) {
|
|||
|
||||
var bound = (coin_ids instanceof Array && coin_ids.length === 0) ? totalCoins.length : 8;
|
||||
|
||||
console.log(totalCoins);
|
||||
for (i = 0; i < bound; i++) {
|
||||
console.log(i + '/' + totalCoins.length);
|
||||
coins.push(totalCoins[i].coin);
|
||||
totalCoins[i].coin.id = totalCoins[i].id;
|
||||
indices.push(totalCoins[i].id);
|
||||
|
|
Loading…
Reference in New Issue