aboutsummaryrefslogtreecommitdiff
path: root/node_simple.js
diff options
context:
space:
mode:
authorNana Nosirova <nargiza.nosirova@mail.utoronto.ca>2018-07-17 02:44:47 +0000
committerGitHub <noreply@github.com>2018-07-17 02:44:47 +0000
commit62b53c0971765a4e5f5d447188eb90bd22571424 (patch)
treed2f7aa3f3bb7b05cd5d3dee288eabf0f38d39b1a /node_simple.js
parent541341598d5ed0e5c8ef9b2325dc6bbec958463a (diff)
parent27f1cff089254b678bfcc695ab40b23a6a65a998 (diff)
Merge pull request #4 from kdam0/feat/SR-35
Feat/sr 35
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
+}