diff options
| author | kumar <kumar.damani@mail.utoronto.ca> | 2016-07-25 13:29:51 +0000 |
|---|---|---|
| committer | kumar <kumar.damani@mail.utoronto.ca> | 2016-07-25 13:29:51 +0000 |
| commit | 249d3dd906ab5b3030b1a25a49ea66205e6a64bb (patch) | |
| tree | b1836d40e8480cfcba06735de1fcfce88a56e55e /node_simple.js | |
| parent | c7bec051d61d66925d68be8661aaf52b011dedac (diff) | |
returns solutions sorted by vote count
Diffstat (limited to 'node_simple.js')
| -rw-r--r-- | node_simple.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/node_simple.js b/node_simple.js index 165eb22..b2c22ea 100644 --- a/node_simple.js +++ b/node_simple.js @@ -760,6 +760,7 @@ exports.add_comment = function (sol_id, fields, serverCallback) { /** * This function will get all the solution for a given exam_id and q_num + * sorted by highest to lowest votes. * * @param {string} exam_id: exam_id for which the info is required. * @param {int} q_num: the question number for which solutions are required. @@ -776,7 +777,7 @@ exports.get_all_solutions = function (exam_id, q_num, callback) { exam_id: exam_id, q_id: q_num } - ).toArray( function (err, docs) { + ).sort({ votes: -1}).toArray( function (err, docs) { if (err) throw err; else { callback(docs); |
