From 35361116f229719866faf58a0c9e849d8e0b103f Mon Sep 17 00:00:00 2001 From: Uotila Terho Date: Tue, 7 Aug 2018 14:08:19 +0300 Subject: [PATCH 1/3] typofix --- Kurki_simulation/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kurki_simulation/index.js b/Kurki_simulation/index.js index a926a2ddd..d2ff57e59 100644 --- a/Kurki_simulation/index.js +++ b/Kurki_simulation/index.js @@ -17,7 +17,7 @@ app.get('/labtool/courses/:id', (req, res) => { }) // If password is "password" and username is listed in -// ./reposonses/users logs in as username. +// ./responses/users logs in as username. // Otherwise, does not let one log in. app.post('/login', (req, res) => { @@ -39,4 +39,4 @@ app.post('/login', (req, res) => { } }) -app.listen(3002, () => console.log('Fake Kurki listening on port 3002.')); \ No newline at end of file +app.listen(3002, () => console.log('Fake Kurki listening on port 3002.')); From 27540dc809ee9dd1db2744031daf2cae5579bedb Mon Sep 17 00:00:00 2001 From: Uotila Terho Date: Tue, 7 Aug 2018 15:31:30 +0300 Subject: [PATCH 2/3] better kurki simulation --- Kurki_simulation/index.js | 3 +- .../responses/{courses.js => 2018K.js} | 3 +- Kurki_simulation/responses/2018S.js | 32 +++++++++++++++++++ Kurki_simulation/responses/2018V.js | 27 ++++++++++++++++ .../responses/TKT20002.2018.S.K.1.js | 15 +++++++++ .../responses/TKT20010.2018.K.A.1.js | 2 +- .../responses/TKT20010.2018.S.K.1.js | 12 +++++++ .../responses/TKT20010.2018.S.K.2.js | 12 +++++++ .../responses/TKT20010.2018.V.K.1.js | 12 +++++++ .../responses/TKT20010.2018.V.K.2.js | 12 +++++++ .../responses/TKT20011.2018.S.K.1.js | 10 ++++++ .../responses/TKT20011.2018.S.K.2.js | 10 ++++++ .../responses/TKT20011.2018.V.K.1.js | 10 ++++++ .../responses/TKT20011.2018.V.K.2.js | 10 ++++++ 14 files changed, 166 insertions(+), 4 deletions(-) rename Kurki_simulation/responses/{courses.js => 2018K.js} (99%) create mode 100644 Kurki_simulation/responses/2018S.js create mode 100644 Kurki_simulation/responses/2018V.js create mode 100644 Kurki_simulation/responses/TKT20002.2018.S.K.1.js create mode 100644 Kurki_simulation/responses/TKT20010.2018.S.K.1.js create mode 100644 Kurki_simulation/responses/TKT20010.2018.S.K.2.js create mode 100644 Kurki_simulation/responses/TKT20010.2018.V.K.1.js create mode 100644 Kurki_simulation/responses/TKT20010.2018.V.K.2.js create mode 100644 Kurki_simulation/responses/TKT20011.2018.S.K.1.js create mode 100644 Kurki_simulation/responses/TKT20011.2018.S.K.2.js create mode 100644 Kurki_simulation/responses/TKT20011.2018.V.K.1.js create mode 100644 Kurki_simulation/responses/TKT20011.2018.V.K.2.js diff --git a/Kurki_simulation/index.js b/Kurki_simulation/index.js index d2ff57e59..3b16de7df 100644 --- a/Kurki_simulation/index.js +++ b/Kurki_simulation/index.js @@ -5,7 +5,8 @@ app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.get('/labtool/courses', (req, res) => { - const responseJson = require('./responses/courses'); + const termString = req.query.year + req.query.term + const responseJson = require('./responses/' + termString); res.json(responseJson.courses); }) diff --git a/Kurki_simulation/responses/courses.js b/Kurki_simulation/responses/2018K.js similarity index 99% rename from Kurki_simulation/responses/courses.js rename to Kurki_simulation/responses/2018K.js index 8ede511e3..595dbd011 100644 --- a/Kurki_simulation/responses/courses.js +++ b/Kurki_simulation/responses/2018K.js @@ -29,6 +29,5 @@ exports.courses = [ "name": "Aineopintojen harjoituskurssi: Opettajalla ei opiskelijanumeroa", "starts": "2018-01-16T21:00:00.000Z", "ends": "2018-03-11T21:00:00.000Z" - - } + } ] diff --git a/Kurki_simulation/responses/2018S.js b/Kurki_simulation/responses/2018S.js new file mode 100644 index 000000000..5ef6b4138 --- /dev/null +++ b/Kurki_simulation/responses/2018S.js @@ -0,0 +1,32 @@ +exports.courses = [ + { + "id": "TKT20010.2018.S.K.1", + "name": "Aineopintojen harjoitustyö: Tietorakenteet ja algoritmit", + "starts": "2018-09-16T21:00:00.000Z", + "ends": "2018-10-11T21:00:00.000Z" + }, + { + "id": "TKT20002.2018.S.K.1", + "name": "Ohjelmistotekniikan menetelmät", + "starts": "2018-09-11T21:00:00.000Z", + "ends": "2018-10-29T21:00:00.000Z" + }, + { + "id": "TKT20011.2018.S.K.1", + "name": "Aineopintojen harjoitustyö: Tietokantasovellus", + "starts": "2018-09-11T21:00:00.000Z", + "ends": "2018-10-29T21:00:00.000Z" + }, + { + "id": "TKT20010.2018.S.K.2", + "name": "Aineopintojen harjoitustyö: Tietorakenteet ja algoritmit", + "starts": "2018-10-16T21:00:00.000Z", + "ends": "2018-12-11T21:00:00.000Z" + }, + { + "id": "TKT20011.2018.S.K.2", + "name": "Aineopintojen harjoitustyö: Tietokantasovellus", + "starts": "2018-10-11T21:00:00.000Z", + "ends": "2018-12-29T21:00:00.000Z" + } +] diff --git a/Kurki_simulation/responses/2018V.js b/Kurki_simulation/responses/2018V.js new file mode 100644 index 000000000..fe9913f40 --- /dev/null +++ b/Kurki_simulation/responses/2018V.js @@ -0,0 +1,27 @@ +exports.courses = [ + + { + "id": "TKT20011.2018.V.K.1", + "name": "Aineopintojen harjoitustyö: Tietokantasovellus (Alkukesä)", + "starts": "2018-05-11T21:00:00.000Z", + "ends": "2018-06-29T21:00:00.000Z" + }, + { + "id": "TKT20010.2018.V.K.1", + "name": "Aineopintojen harjoitustyö: Tietorakenteet ja algoritmit (Alkukesä)", + "starts": "2018-05-16T21:00:00.000Z", + "ends": "2018-06-11T21:00:00.000Z" + }, + { + "id": "TKT20011.2018.V.K.2", + "name": "Aineopintojen harjoitustyö: Tietokantasovellus (Loppukesä)", + "starts": "2018-07-27T21:00:00.000Z", + "ends": "2018-08-29T21:00:00.000Z" + }, + { + "id": "TKT20010.2018.V.K.2", + "name": "Aineopintojen harjoitustyö: Tietorakenteet ja algoritmit (Loppukesä)", + "starts": "2018-07-27T21:00:00.000Z", + "ends": "2018-08-29T21:00:00.000Z" + } +] diff --git a/Kurki_simulation/responses/TKT20002.2018.S.K.1.js b/Kurki_simulation/responses/TKT20002.2018.S.K.1.js new file mode 100644 index 000000000..89c41c021 --- /dev/null +++ b/Kurki_simulation/responses/TKT20002.2018.S.K.1.js @@ -0,0 +1,15 @@ +exports.course = { + "students": [ + "014893873", + "014872455", + "014552657", + "014666666", + // otm random opiskelijoilla on vain kaksi opiskelijanumeroa, koska liian myöhään huomattu virhe datan generoinnissa + // ei pitäisi vaikuttaa sovelluksen toimintaan + "015492103", + "015689338" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20010.2018.K.A.1.js b/Kurki_simulation/responses/TKT20010.2018.K.A.1.js index f9aafc187..cc2cbf00c 100644 --- a/Kurki_simulation/responses/TKT20010.2018.K.A.1.js +++ b/Kurki_simulation/responses/TKT20010.2018.K.A.1.js @@ -1,6 +1,6 @@ exports.course = { "students": [ - "014578343", + "014578343", "014553242", "014623598", "014666666", diff --git a/Kurki_simulation/responses/TKT20010.2018.S.K.1.js b/Kurki_simulation/responses/TKT20010.2018.S.K.1.js new file mode 100644 index 000000000..cc2cbf00c --- /dev/null +++ b/Kurki_simulation/responses/TKT20010.2018.S.K.1.js @@ -0,0 +1,12 @@ +exports.course = { + "students": [ + "014578343", + "014553242", + "014623598", + "014666666", + "012345678" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20010.2018.S.K.2.js b/Kurki_simulation/responses/TKT20010.2018.S.K.2.js new file mode 100644 index 000000000..cc2cbf00c --- /dev/null +++ b/Kurki_simulation/responses/TKT20010.2018.S.K.2.js @@ -0,0 +1,12 @@ +exports.course = { + "students": [ + "014578343", + "014553242", + "014623598", + "014666666", + "012345678" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20010.2018.V.K.1.js b/Kurki_simulation/responses/TKT20010.2018.V.K.1.js new file mode 100644 index 000000000..cc2cbf00c --- /dev/null +++ b/Kurki_simulation/responses/TKT20010.2018.V.K.1.js @@ -0,0 +1,12 @@ +exports.course = { + "students": [ + "014578343", + "014553242", + "014623598", + "014666666", + "012345678" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20010.2018.V.K.2.js b/Kurki_simulation/responses/TKT20010.2018.V.K.2.js new file mode 100644 index 000000000..cc2cbf00c --- /dev/null +++ b/Kurki_simulation/responses/TKT20010.2018.V.K.2.js @@ -0,0 +1,12 @@ +exports.course = { + "students": [ + "014578343", + "014553242", + "014623598", + "014666666", + "012345678" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20011.2018.S.K.1.js b/Kurki_simulation/responses/TKT20011.2018.S.K.1.js new file mode 100644 index 000000000..204e36035 --- /dev/null +++ b/Kurki_simulation/responses/TKT20011.2018.S.K.1.js @@ -0,0 +1,10 @@ +exports.course = { + "students": [ + "014845204", + "014952347", + "014666666" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20011.2018.S.K.2.js b/Kurki_simulation/responses/TKT20011.2018.S.K.2.js new file mode 100644 index 000000000..204e36035 --- /dev/null +++ b/Kurki_simulation/responses/TKT20011.2018.S.K.2.js @@ -0,0 +1,10 @@ +exports.course = { + "students": [ + "014845204", + "014952347", + "014666666" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20011.2018.V.K.1.js b/Kurki_simulation/responses/TKT20011.2018.V.K.1.js new file mode 100644 index 000000000..204e36035 --- /dev/null +++ b/Kurki_simulation/responses/TKT20011.2018.V.K.1.js @@ -0,0 +1,10 @@ +exports.course = { + "students": [ + "014845204", + "014952347", + "014666666" + ], + "teachers": [ + "paaopettaja" + ] +} diff --git a/Kurki_simulation/responses/TKT20011.2018.V.K.2.js b/Kurki_simulation/responses/TKT20011.2018.V.K.2.js new file mode 100644 index 000000000..204e36035 --- /dev/null +++ b/Kurki_simulation/responses/TKT20011.2018.V.K.2.js @@ -0,0 +1,10 @@ +exports.course = { + "students": [ + "014845204", + "014952347", + "014666666" + ], + "teachers": [ + "paaopettaja" + ] +} From 28e076579539931ecc3caf2e3f3f5a43edb9fa24 Mon Sep 17 00:00:00 2001 From: Uotila Terho Date: Tue, 7 Aug 2018 15:41:20 +0300 Subject: [PATCH 3/3] bugfix --- backend/server/helpers/application_helper.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/server/helpers/application_helper.js b/backend/server/helpers/application_helper.js index 36b3a9b24..f4b1a2814 100755 --- a/backend/server/helpers/application_helper.js +++ b/backend/server/helpers/application_helper.js @@ -46,13 +46,13 @@ function CurrentTermAndYear() { * @returns {string} */ function getCurrentTerm(month) { - if (1 <= month <= 5) { + if (1 <= month && month <= 5) { return 'K' } - if (6 <= month <= 8) { + if (6 <= month && month <= 8) { return 'V' } - if (9 <= month <= 12) { + if (9 <= month && month <= 12) { return 'S' } }