diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-22 21:43:44 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-22 21:43:44 +0000 |
| commit | c17afa29125f162df7d47e36cee55ec7cdbee9de (patch) | |
| tree | aca01f0f801b7199de8e7923c50d47f302b73db7 /routes | |
| parent | fef388a0479b36c13ac286db65eadc756b5b197b (diff) | |
| parent | 1da28e930df1438fee1528c4dbb2c024fc3824e7 (diff) | |
resolved minor conflict
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/index.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/routes/index.js b/routes/index.js index 0b59988..30189da 100644 --- a/routes/index.js +++ b/routes/index.js @@ -91,6 +91,41 @@ 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); + }); +}); + +router.get('/add_solution',function (req, res) { + redirect('/add_solutions_page'); +}); + +router.post('/add_solutions/submit', function (req, res) { + //TODO: get the form information for the solutions +}); /**** Helpers ****/ |
