aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
authorWaref Haque <warefhaque@inside-239-60.wireless.utoronto.ca>2016-07-21 02:10:32 +0000
committerWaref Haque <warefhaque@inside-239-60.wireless.utoronto.ca>2016-07-21 02:10:32 +0000
commitd694c1a73f77def42c17b58027f046bf9e1af809 (patch)
tree69493f47d2a0c495fc66dff7d1c26c47f65c6735 /routes
parentd46b37fcb7c97ab59fd929cfc0a8d766ca8a0b8a (diff)
questions for each exam page
Diffstat (limited to 'routes')
-rw-r--r--routes/index.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/routes/index.js b/routes/index.js
index 84087e7..16f5778 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -83,6 +83,27 @@ router.get('/search', function(req, res, next) {
res.redirect('/exams/' + courseName);
});
+
+/* REDIRECT - exam -> questions page*/
+router.get('/exam_click',function (req,res) {
+ //TODO:get needs to have exam_id attached
+ var examId = req.query.exam_id;
+ res.redirect('/questions/'+examId);
+});
+
+/*EXAMPLE DATA GIVEN BELOW:
+ * questions = [{id,count,comments},{id,count,comments}] --> array of "question" objects
+ *
+ * id = questions number
+ * count= number of solutions
+ * comments = number of comments*/
+router.get('/questions/:exam_id', function (req,res) {
+ dbFile.get_exam_info_by_ID(req.params.exam_id, function (questions) {
+
+ res.render('questions', {query: questions});
+ });
+});
+
router.get('/signup', function(req, res, next) {
res.render('signup', {csrfToken: req.csrfToken()});
});