aboutsummaryrefslogtreecommitdiff
path: root/node_simple.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_simple.js')
-rw-r--r--node_simple.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/node_simple.js b/node_simple.js
index 2f49360..f07c0e8 100644
--- a/node_simple.js
+++ b/node_simple.js
@@ -648,6 +648,24 @@ exports.updatePassword = function (email, password, callback) {
/************************* COURSES / EXAMS **********************************/
+
+/**
+ * Find all UNIQUE course codes from EXAMS collection
+ *
+ * @param {function} callback: 2 args: (<string>),
+ * where <string> : couseCodes array
+ */
+exports.find_all_course_codes_from_exams = function (callback) {
+ var exams = db.collection('exams');
+ exams.distinct("course_code", function (err, result) {
+ if (err) callback(false, "Failed to get unique courses");
+ else {
+ callback(true, result);
+ }
+ });
+};
+
+
/**
* Remvove a course from ONLY the courses table IN CASE of accidental
* addition.
@@ -1435,4 +1453,4 @@ exports.getNotifications = function(email, callback) {
});
-} \ No newline at end of file
+}