aboutsummaryrefslogtreecommitdiff
path: root/routes/index.js
diff options
context:
space:
mode:
authorWaref Haque <warefhaque@inside-239-60.wireless.utoronto.ca>2016-07-22 20:58:59 +0000
committerWaref Haque <warefhaque@inside-239-60.wireless.utoronto.ca>2016-07-22 20:58:59 +0000
commit42d17334a8915bb8f5e7c605a38dac56462499b1 (patch)
tree9922b0fa7cfed20cb93b5bf75cfd9d1acaa905b6 /routes/index.js
parent90fe02430c828b0d99d5f60c3073c54278d85236 (diff)
solutions given the exam_id and the questions number
Diffstat (limited to 'routes/index.js')
-rw-r--r--routes/index.js28
1 files changed, 27 insertions, 1 deletions
diff --git a/routes/index.js b/routes/index.js
index a0a66d0..1b00f41 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -145,7 +145,33 @@ router.get('/questions/:exam_id', function (req,res) {
});
});
-
+/*GET the solutions for a given exam given the question number and the exam_id*/
+/*EXPECTED DATA GIVEN BELOW:
+array of solutions:
+* solutions = [ {
+ * _id: "354ff71ed078933079d6467e"
+ * exam_id: "578a44ff71ed097fc3079d6e"
+ * q_id: 1 (int)
+ * text: "answer"
+ * votes: 1 (int)
+ * comments: [{}.{}] (just going to be string for now i think)
+ * }
+ * {
+ * _id: ...
+ * exam_id: ..
+ * q_id: ...
+ * text: ..
+ * votes: ..
+ * comments: ..
+ *
+ * }
+ * ]*/
+router.get('/solutions/:exam_id/:q_num', function (req, res) {
+ dbFile.get_all_solutions(req.params.exam_id,req.params.q_num,function (solutions) {
+ res.render('solutions', {query: solutions});
+ console.log(solutions);
+ });
+});
/**** Helpers ****/