aboutsummaryrefslogtreecommitdiff
path: root/node_simple.js
diff options
context:
space:
mode:
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);