Skip to content

Commit

Permalink
When saving a new iqset, the server always overrided the session valu…
Browse files Browse the repository at this point in the history
…es to insert 'Teacher' and 'General'. Not anymore now.
  • Loading branch information
chrqls committed Apr 19, 2014
1 parent 769dffa commit 3ccb8c4
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,7 @@ exports.handleDeleteIQSet = function(req, res) {
exports.handlePostNewIQSet = function(req, res) {

console.log("\n\n[BODY of json request]");
console.log("\t>> %j\n", req.body);
console.log("[HEADERS of json request]");
console.log("\t>> %j\n\n", req.headers);
console.log("%j\n", req.body);

var headers = req.headers;
var iqset;
Expand All @@ -136,21 +134,9 @@ exports.handlePostNewIQSet = function(req, res) {
iqset = req.body;
}

if (!iqset.title) {
// iqset.title = iqdoc.date + "-IQSet";
}

if (!iqset.teachername) {
// iqset.teachername = "Teacher";
}

if (!iqset.groupname) {
// iqset.groupname = "General";
}

if (!iqset.iqdata) {
isValid = false;
}
// Adding values of the current session before saving the IQSet
iqset.teachername = game.teacherName;
iqset.groupname = game.groupName;

if (isValid === true) {
//
Expand All @@ -165,7 +151,6 @@ exports.handlePostNewIQSet = function(req, res) {
// 1. Get the original index of the image
// 2. Change the PICURL to match the new index
//

if (iqset.iqdata[i].PICURL) {
// /smile/questionview/1.jpg
var tmpidx = parseInt(iqset.iqdata[i].PICURL.split('/')[3].split('.')[0], 10);
Expand Down

0 comments on commit 3ccb8c4

Please sign in to comment.