From cbcf2f83d7a11895deeb1234504dd767d8826d4d Mon Sep 17 00:00:00 2001 From: kumar Date: Sat, 23 Jul 2016 23:32:57 -0400 Subject: updated todo lst --- node_simple.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'node_simple.js') diff --git a/node_simple.js b/node_simple.js index f57b3aa..e18839b 100644 --- a/node_simple.js +++ b/node_simple.js @@ -6,12 +6,16 @@ * 2. add upload date and user name ? DONE * 3. remove exam ? DONE * 4a. get all questions for a given exam_id ? DONE - * 4b. add exam id to each question returned. ? PENDING + * 4b. add exam id to each question returned. ? NO NEED * 6. get all solutions provided question_id and exam_id ? DONE - * 5. solutions ? CURRENTLY WORKING ON -- need to add field for solutions provider, and updating. + * 5. solutions ? DONE -- need to add field for solutions provider, and updating. DONE * 7. add university field to courses, exams ? PENDING * 8. make a user ? DONE * 9. update user info when they comment or post a solution ? PENDING + * 10. comment_history ? DONE + * 11. solutions_history ? DONE + * 12. voting for solutions ? DONE + * * */ -- cgit v1.2.3 From 807eb06e57ba4454bdba32493ae603ef9c2c45a1 Mon Sep 17 00:00:00 2001 From: HumairAK Date: Sun, 24 Jul 2016 00:09:06 -0400 Subject: Added some add_solutions functionality --- node_simple.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'node_simple.js') diff --git a/node_simple.js b/node_simple.js index 58a114b..bb291cc 100644 --- a/node_simple.js +++ b/node_simple.js @@ -41,10 +41,10 @@ // |..........| -// |================================solutions============================================| -// |_________ _id_____________|exam_id_____________________|q_id_|text____|votes|comments| -// |==========================|============================|=====|========|=====|========| -// |"354ff71ed078933079d6467e"|"578a44ff71ed097fc3079d6e" |1 |"answer"| 1 |[{},{}] | +// |================================solutions========================================================| +// |_________ _id_____________|exam_id_____________________|q_id_|text____|votes|comments | author | +// |==========================|============================|=====|========|=====|===========|========| +// |"354ff71ed078933079d6467e"|"578a44ff71ed097fc3079d6e" |1 |"answer"| 1 |[{},{}] | joe | // |..........| // |========================================users===============================================================================| @@ -525,8 +525,6 @@ exports.get_all_solutions = function (exam_id, q_num, callback) { ).toArray( function (err, docs) { if (err) throw err; else { - console.log(docs); - callback(docs); } }); @@ -556,29 +554,31 @@ exports.add_solution = function (fields, callback) { comments: [], author: fields[3] }; - + console.log("CHECK 1"); // establish a connection mongoFactory.getConnection(uri) .then(function(db) { - + console.log("CHECK 2"); // find the solutions table var solutions = db.collection('solutions'); // insert data into table solutions.insert(Data, function(err) { if (err) callback(false , "Error: Failed to add the solution"); else { + console.log("CHECK 3"); // console.log("solution added"); - callback(true, "Success: added exam successfully!"); + callback(true, "Success: added solution successfully!"); db.close(function (err) { // close the connection when done if (err) throw err; }); + console.log("CHECK 4"); } }); }) .catch(function(err) { console.error(err); }); - + console.log("CHECK 5"); }; /* -- cgit v1.2.3 From 513312a00975a3fa0848736829e00d46825e853f Mon Sep 17 00:00:00 2001 From: HumairAK Date: Sun, 24 Jul 2016 00:19:27 -0400 Subject: minor fixes --- node_simple.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'node_simple.js') diff --git a/node_simple.js b/node_simple.js index d9835a8..74a28db 100644 --- a/node_simple.js +++ b/node_simple.js @@ -557,31 +557,31 @@ exports.add_solution = function (fields, callback) { comments: [], author: fields[3] }; - console.log("CHECK 1"); + // establish a connection mongoFactory.getConnection(uri) .then(function(db) { - console.log("CHECK 2"); + // find the solutions table var solutions = db.collection('solutions'); // insert data into table solutions.insert(Data, function(err) { if (err) callback(false , "Error: Failed to add the solution"); else { - console.log("CHECK 3"); + // console.log("solution added"); callback(true, "Success: added solution successfully!"); db.close(function (err) { // close the connection when done if (err) throw err; }); - console.log("CHECK 4"); + } }); }) .catch(function(err) { console.error(err); }); - console.log("CHECK 5"); + }; -- cgit v1.2.3