aboutsummaryrefslogtreecommitdiff
path: root/node_simple.js
diff options
context:
space:
mode:
authorkumar <kumar.damani@mail.utoronto.ca>2016-07-25 13:29:51 +0000
committerkumar <kumar.damani@mail.utoronto.ca>2016-07-25 13:29:51 +0000
commit249d3dd906ab5b3030b1a25a49ea66205e6a64bb (patch)
treeb1836d40e8480cfcba06735de1fcfce88a56e55e /node_simple.js
parentc7bec051d61d66925d68be8661aaf52b011dedac (diff)
returns solutions sorted by vote count
Diffstat (limited to 'node_simple.js')
-rw-r--r--node_simple.js3
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);