From bcd20539c1e6be5ad5bbd80dd80e5d84a6ffb0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A4kinen=20Sasu=20S?= Date: Fri, 24 May 2019 12:00:50 +0300 Subject: [PATCH 1/3] modify logging --- .../backend/updater_writer/updater/database_updater.js | 7 ++----- .../updater_api/doo_api_database_updater/oodi_interface.js | 4 ++-- services/updater_api/logger.js | 2 -- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/services/backend/updater_writer/updater/database_updater.js b/services/backend/updater_writer/updater/database_updater.js index bd5cc94b72..f3bf12300a 100644 --- a/services/backend/updater_writer/updater/database_updater.js +++ b/services/backend/updater_writer/updater/database_updater.js @@ -38,7 +38,7 @@ const updateAttainments = (studyAttainments, transaction) => studyAttainments.ma creditTeachers.length > 0 && Promise.all(creditTeachers.map(cT => CreditTeacher.upsert(cT, { transaction }))) ]) } catch (e) { - console.log(e) + console.log('attainment update failed', e) } }) @@ -61,12 +61,9 @@ const updateStudent = async (student) => { await deleteStudentStudyrights(studentInfo.studentnumber, transaction) // this needs to be done because Oodi just deletes deprecated studyrights from students ( big yikes ) await Student.upsert(studentInfo, { transaction }) - try { await Promise.all(semesterEnrollments.map(SE => SemesterEnrollment.upsert(SE, { transaction }))) - } catch(e) { - console.log(e) - } + if (studyAttainments) await Promise.all(updateAttainments(studyAttainments, transaction)) if (studyRights) await Promise.all(updateStudyRights(studyRights, transaction)) diff --git a/services/updater_api/doo_api_database_updater/oodi_interface.js b/services/updater_api/doo_api_database_updater/oodi_interface.js index a52e4d966e..bd253119ea 100644 --- a/services/updater_api/doo_api_database_updater/oodi_interface.js +++ b/services/updater_api/doo_api_database_updater/oodi_interface.js @@ -36,7 +36,7 @@ const attemptGetFor = async (url, attempts = 5) => { attempt += 1 try { response = await getUrl(url) - logger.info('requested url', { url, status: response.status }) + logger.info('requested url', { url, success: response.status === 200 }) return response } catch (error) { if (attempt === attempts) { @@ -63,7 +63,7 @@ console.log(process.env.NODE_ENV) const getStudent = async studentNumber => { const url = `${base_url}/students/${studentNumber}/info` try { - const response = await getUrl(url) + const response = await attemptGetFor(url) const data = response.data.data return data } catch (e) { diff --git a/services/updater_api/logger.js b/services/updater_api/logger.js index caa3b72faf..09394083e5 100644 --- a/services/updater_api/logger.js +++ b/services/updater_api/logger.js @@ -16,8 +16,6 @@ if (process.env.NODE_ENV !== 'test') { transports.push(new winston.transports.File({ filename: 'debug.log' })) } -transports.push(new winston.transports.Console({ level: 'debug' })) - const logger = winston.createLogger({ transports }) From 5e93756feeeac6a92a000a4f4d0cdc07f12b90fa Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Fri, 24 May 2019 12:08:23 +0300 Subject: [PATCH 2/3] Fix student graph being --- .../src/components/CreditAccumulationGraph/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/oodikone2-frontend/src/components/CreditAccumulationGraph/index.jsx b/services/oodikone2-frontend/src/components/CreditAccumulationGraph/index.jsx index 56d52f3478..d4b3bd7c5d 100644 --- a/services/oodikone2-frontend/src/components/CreditAccumulationGraph/index.jsx +++ b/services/oodikone2-frontend/src/components/CreditAccumulationGraph/index.jsx @@ -126,7 +126,7 @@ class CreditAccumulationGraph extends Component { .filter(c => moment(c.date).isSameOrAfter(moment(startDate))) let totalCredits = 0 - return filteredCourses.map((c) => { + return _.orderBy(filteredCourses, ['date'], ['asc']).map((c) => { const { course, date, credits, grade, passed, isStudyModuleCredit } = c From b8cb6f7e9e82a8dd52641780e007c34c1b69fce2 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Fri, 24 May 2019 12:09:16 +0300 Subject: [PATCH 3/3] add nats dependency --- docker-compose.lateste2e.production.yml | 1 + docker-compose.lateste2e.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/docker-compose.lateste2e.production.yml b/docker-compose.lateste2e.production.yml index 347a8ff87a..15f2c628e8 100644 --- a/docker-compose.lateste2e.production.yml +++ b/docker-compose.lateste2e.production.yml @@ -96,6 +96,7 @@ services: depends_on: - db - redis + - nats frontend: image: toska/oodikone2-frontend:latest diff --git a/docker-compose.lateste2e.yml b/docker-compose.lateste2e.yml index 4717a6c5ce..9f67854499 100644 --- a/docker-compose.lateste2e.yml +++ b/docker-compose.lateste2e.yml @@ -98,6 +98,7 @@ services: depends_on: - db - redis + - nats frontend: image: toska/oodikone2-frontend:staging