From daefddd8dc45e7044e83bd40706cfdca36471fe9 Mon Sep 17 00:00:00 2001 From: Waref Haque Date: Tue, 19 Jul 2016 00:21:17 -0400 Subject: proper exams rendering --- .idea/jsLibraryMappings.xml | 7 + .idea/libraries/solutions_repo_node_modules.xml | 14 ++ .idea/modules.xml | 8 + .idea/solutions_repo.iml | 9 + .idea/vcs.xml | 6 + .idea/workspace.xml | 248 ++++++++++++++++++++++++ app.js | 48 ----- routes/index.js | 45 ++++- 8 files changed, 335 insertions(+), 50 deletions(-) create mode 100644 .idea/jsLibraryMappings.xml create mode 100644 .idea/libraries/solutions_repo_node_modules.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/solutions_repo.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..ddeb853 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/solutions_repo_node_modules.xml b/.idea/libraries/solutions_repo_node_modules.xml new file mode 100644 index 0000000..fd48a42 --- /dev/null +++ b/.idea/libraries/solutions_repo_node_modules.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3d57a3a --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/solutions_repo.iml b/.idea/solutions_repo.iml new file mode 100644 index 0000000..004ef7c --- /dev/null +++ b/.idea/solutions_repo.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..a15a1d8 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1468901747117 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app.js b/app.js index e4d0843..ba7c014 100644 --- a/app.js +++ b/app.js @@ -32,51 +32,3 @@ app.use(express.static(__dirname)); app.use('/', routes); module.exports = app; - -app.listen(3000, function() { - console.log('listening on http://localhost:3000/'); -}); - -//to fetch exams given a course code and populate the exams page -app.get('/exams',function (req,res) { - console.log(req.query.search); - var courseName = req.query.search; - courseName = sanitizer.escape(courseName); - courseName = courseName.toUpperCase(); - console.log(courseName); - var result = getExamsForCourseCode(courseName); - console.log(result); - res.write(JSON.stringify(result)); -}); - -function getExamsForCourseCode(courseCode) { - var minExamInfoArray = []; - dbFile.get_all_exams(courseCode, function (exams) { - if (exams.length == 0){ - console.log("Nothing was found"); - } - else { - //console.log(exams); - //only pass over the information that is necessary for the exams page - for (var i = 0; i