Skip to content

Commit

Permalink
Merge pull request #510 from UniversityOfHelsinkiCS/trunk
Browse files Browse the repository at this point in the history
bugfix
  • Loading branch information
qzuw authored Aug 7, 2018
2 parents a4785eb + 28e0765 commit fddc475
Show file tree
Hide file tree
Showing 15 changed files with 171 additions and 9 deletions.
7 changes: 4 additions & 3 deletions Kurki_simulation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})

Expand All @@ -17,7 +18,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) => {

Expand All @@ -39,4 +40,4 @@ app.post('/login', (req, res) => {
}
})

app.listen(3002, () => console.log('Fake Kurki listening on port 3002.'));
app.listen(3002, () => console.log('Fake Kurki listening on port 3002.'));
Original file line number Diff line number Diff line change
Expand Up @@ -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"

}
}
]
32 changes: 32 additions & 0 deletions Kurki_simulation/responses/2018S.js
Original file line number Diff line number Diff line change
@@ -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"
}
]
27 changes: 27 additions & 0 deletions Kurki_simulation/responses/2018V.js
Original file line number Diff line number Diff line change
@@ -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"
}
]
15 changes: 15 additions & 0 deletions Kurki_simulation/responses/TKT20002.2018.S.K.1.js
Original file line number Diff line number Diff line change
@@ -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"
]
}
2 changes: 1 addition & 1 deletion Kurki_simulation/responses/TKT20010.2018.K.A.1.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.course = {
"students": [
"014578343",
"014578343",
"014553242",
"014623598",
"014666666",
Expand Down
12 changes: 12 additions & 0 deletions Kurki_simulation/responses/TKT20010.2018.S.K.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exports.course = {
"students": [
"014578343",
"014553242",
"014623598",
"014666666",
"012345678"
],
"teachers": [
"paaopettaja"
]
}
12 changes: 12 additions & 0 deletions Kurki_simulation/responses/TKT20010.2018.S.K.2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exports.course = {
"students": [
"014578343",
"014553242",
"014623598",
"014666666",
"012345678"
],
"teachers": [
"paaopettaja"
]
}
12 changes: 12 additions & 0 deletions Kurki_simulation/responses/TKT20010.2018.V.K.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exports.course = {
"students": [
"014578343",
"014553242",
"014623598",
"014666666",
"012345678"
],
"teachers": [
"paaopettaja"
]
}
12 changes: 12 additions & 0 deletions Kurki_simulation/responses/TKT20010.2018.V.K.2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exports.course = {
"students": [
"014578343",
"014553242",
"014623598",
"014666666",
"012345678"
],
"teachers": [
"paaopettaja"
]
}
10 changes: 10 additions & 0 deletions Kurki_simulation/responses/TKT20011.2018.S.K.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
exports.course = {
"students": [
"014845204",
"014952347",
"014666666"
],
"teachers": [
"paaopettaja"
]
}
10 changes: 10 additions & 0 deletions Kurki_simulation/responses/TKT20011.2018.S.K.2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
exports.course = {
"students": [
"014845204",
"014952347",
"014666666"
],
"teachers": [
"paaopettaja"
]
}
10 changes: 10 additions & 0 deletions Kurki_simulation/responses/TKT20011.2018.V.K.1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
exports.course = {
"students": [
"014845204",
"014952347",
"014666666"
],
"teachers": [
"paaopettaja"
]
}
10 changes: 10 additions & 0 deletions Kurki_simulation/responses/TKT20011.2018.V.K.2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
exports.course = {
"students": [
"014845204",
"014952347",
"014666666"
],
"teachers": [
"paaopettaja"
]
}
6 changes: 3 additions & 3 deletions backend/server/helpers/application_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
Expand Down

0 comments on commit fddc475

Please sign in to comment.