aboutsummaryrefslogtreecommitdiff
path: root/node_simple.js
diff options
context:
space:
mode:
authorNana Nosirova <nargiza.nosirova@mail.utoronto.ca>2018-07-17 02:44:31 +0000
committerGitHub <noreply@github.com>2018-07-17 02:44:31 +0000
commit77168116122c0c5e37405fddaee785efca414f6e (patch)
tree32a4bcfc6b591e25ca86bb55fafc8f5e75c2a118 /node_simple.js
parentc9f4e0e9df821c305b9606bd9575d3092384205b (diff)
parent60a53ac331e33cab3173a6803dcf11de3ff47ae6 (diff)
Merge pull request #3 from kdam0/feat/SR-26qa
Feat/SR-26
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 f7d2289..13db6c1 100644
--- a/node_simple.js
+++ b/node_simple.js
@@ -654,6 +654,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.
@@ -1441,4 +1459,4 @@ exports.getNotifications = function(email, callback) {
});
-} \ No newline at end of file
+}