diff options
| author | HumairAK <humair88@hotmail.com> | 2016-07-24 21:48:06 +0000 |
|---|---|---|
| committer | HumairAK <humair88@hotmail.com> | 2016-07-24 21:48:06 +0000 |
| commit | 2f819f8f2cfa5d2c5613f1f3d8b47b6a36331659 (patch) | |
| tree | 0c79fab94eadf50566ea968c59a3cc9da314df63 /routes/user.js | |
| parent | a0e04574545c4f2751c01c5919c34f6f99bc21ad (diff) | |
Added voting to front end
Diffstat (limited to 'routes/user.js')
| -rw-r--r-- | routes/user.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/routes/user.js b/routes/user.js index c466e3c..f5dab0c 100644 --- a/routes/user.js +++ b/routes/user.js @@ -257,10 +257,27 @@ router.post('/comment/submit/:examID/:qID/:solID', function(req, res, next){ } }); +router.post('/solution/vote/:examID/:qID/:solID', function(req, res, next){ + var vote = req.body.vote; + var examID = req.params.examID; + var qID = req.params.qID; + var solutionID = req.params.solID; + dbFile.vote_solution(solutionID, vote, function(voteCounted, statusMsg){ + if(voteCounted){ + console.log("Success!"); + }else{ + console.log("Action failed!"); + } + console.log(statusMsg); // Change to display message above + res.redirect('/solutions/' + examID + '/' + qID); + }); + + +}); + module.exports = router; /************** Route protection ********************/ - function loggedIn(req, res, next) { if (req.isAuthenticated()) { return next(); |
