aboutsummaryrefslogtreecommitdiff
path: root/testImports.js
blob: c9f0bb24e78c9ad5d442b4854d406f4f21fa628e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
var dbFile = require("./node_simple");

var fields = ["CSC240", 2016, "fall", "midterm", ["Faith Ellen", "Tom F."], 20, 2, "some date", "some user name"];
var questions_array = ["this is q1", "this is q2"];


// *****************************************************************************
//                         EXAMPLE USAGE
// *****************************************************************************


// test adding of exams to the database functionality
// dbFile.add_exam(fields, questions_array);

//test removal of exam from the database functionality
//dbFile.remove_exam([fields[0],fields[1],fields[2],fields[3]]);


//test getting all exams database functionality -- USE FOR THE EXAMS PAGES maybe?
/*dbFile.get_all_exams("CSC240", function (exams) {
     if (exams.length == 0){
        console.log("Nothing was found");
    }
    else {
        console.log(exams);
    }
});*/

//test adding course
// dbFile.add_course("CSC148", "Intro to Programming");

//test adding solution
//dbFile.add_solution(["578a44ff71ed097fc3079d6e", 2, "this is a solution to q2"]);


// the following just prints the exam to console
// dbFile.get_exam_byID("578a44ff71ed097fc3079d6e");

//test getting all solutions of a given exam and question number
//dbFile.get_all_solutions("578a44ff71ed097fc3079d6e", 1);


//test adding of comments given a solution_id, and the comment information as an array
// dbFile.add_comment("578f08e43bba452ee98da444", ["this is asdfasdf", "this is the date", "this is the author"]);


dbFile.get_exam_info_by_ID("578a44ff71ed097fc3079d6e", function (result) {
    if (result.length == 0) {
        console.log("some error occured");
    }
    else {
        console.log(result);
    }
});