From f40caabf2577006ff5331761741244ca93193d2a Mon Sep 17 00:00:00 2001 From: esakemp Date: Fri, 19 Jul 2019 09:24:23 +0300 Subject: [PATCH 1/4] fixed 'when passed' course table in population statistics --- .../src/services/course_stats_counter.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/backend/oodikone2-backend/src/services/course_stats_counter.js b/services/backend/oodikone2-backend/src/services/course_stats_counter.js index f85b43e5ca..3e63009276 100644 --- a/services/backend/oodikone2-backend/src/services/course_stats_counter.js +++ b/services/backend/oodikone2-backend/src/services/course_stats_counter.js @@ -19,7 +19,8 @@ class CourseStatsCounter { failedMany: {}, improvedPassedGrade: {}, notParticipated: { ...allstudents }, - notParticipatedOrFailed: { ...allstudents } + notParticipatedOrFailed: { ...allstudents }, + markedToSemester: {} } this.stats = { students: 0, @@ -67,6 +68,10 @@ class CourseStatsCounter { this.stats.passingSemesters[semester]++ } + markToSemester(studentnumber) { + this.students.markedToSemester[studentnumber] = true + } + markCredit(studentnumber, grade, passed, failed, improved, semester) { // studentnumber = `${shajs('sha256').update(process.env.key + studentnumber).digest('hex')}` this.markAttempt() @@ -74,8 +79,9 @@ class CourseStatsCounter { this.markGrade(grade, passed, failed, improved) this.markToAll(studentnumber) if (passed) { - if (!improved && !this.students.passed[studentnumber]) { + if (!this.students.markedToSemester[studentnumber]) { this.markPassedSemester(semester) + this.markToSemester(studentnumber) } this.markPassingGrade(studentnumber) } else if (improved) { From 7392f026dc82acaa00249a3fa6b54a82579df397 Mon Sep 17 00:00:00 2001 From: Warro Date: Fri, 19 Jul 2019 10:18:05 +0300 Subject: [PATCH 2/4] Fixed an issue in the student graph where tooltip of courses with same id only showed info about the first of those courses --- services/oodikone2-frontend/src/common/index.js | 2 +- .../components/CreditAccumulationGraphHighCharts/index.jsx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/services/oodikone2-frontend/src/common/index.js b/services/oodikone2-frontend/src/common/index.js index 2b1948071e..044d43fded 100644 --- a/services/oodikone2-frontend/src/common/index.js +++ b/services/oodikone2-frontend/src/common/index.js @@ -217,7 +217,7 @@ export const getTextIn = (texts, language) => { } export const useTabs = (id, initialTab, { location, replace }) => { - const [tab, setTab] = useState(null) + const [tab, setTab] = useState(-1) const [didMount, setDidMount] = useState(false) const pushToUrl = (newTab) => { diff --git a/services/oodikone2-frontend/src/components/CreditAccumulationGraphHighCharts/index.jsx b/services/oodikone2-frontend/src/components/CreditAccumulationGraphHighCharts/index.jsx index 4362f58800..5733cfc6c7 100644 --- a/services/oodikone2-frontend/src/components/CreditAccumulationGraphHighCharts/index.jsx +++ b/services/oodikone2-frontend/src/components/CreditAccumulationGraphHighCharts/index.jsx @@ -80,7 +80,10 @@ class CreditAccumulationGraphHighCharts extends Component { createTooltip = (point) => { const { students, language, translate } = this.props const targetCourse = this.sortCoursesByDate(students[0].courses) - .find(c => c.course.code === point.key) + .find(c => ( + point.key === c.course.code && + point.x === new Date(c.date).getTime() + )) if (!targetCourse) return '' From fc30785cea4597eec626b4d08883a5077ebcff43 Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Fri, 19 Jul 2019 10:30:58 +0300 Subject: [PATCH 3/4] Configure release version to sentry so source maps can be found from correct release --- services/oodikone2-frontend/src/app.jsx | 5 ++++- services/oodikone2-frontend/webpack.config.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/services/oodikone2-frontend/src/app.jsx b/services/oodikone2-frontend/src/app.jsx index f354c22fad..16501fb539 100644 --- a/services/oodikone2-frontend/src/app.jsx +++ b/services/oodikone2-frontend/src/app.jsx @@ -17,7 +17,10 @@ const IS_PRODUCTION = process.env.NODE_ENV === 'production' try { if (IS_PRODUCTION && BASE_PATH === '/') { - Sentry.init({ dsn: 'https://02d07bd40f404cc0965f38f06183d9fb@toska.cs.helsinki.fi/3' }) // eslint-disable-line + Sentry.init({ + dsn: 'https://02d07bd40f404cc0965f38f06183d9fb@toska.cs.helsinki.fi/3', + release: process.env.SENTRY_RELEASE_VERSION + }) } } catch (e) { console.log(e) // eslint-disable-line diff --git a/services/oodikone2-frontend/webpack.config.js b/services/oodikone2-frontend/webpack.config.js index 2ec096d9f9..5f14acbd03 100644 --- a/services/oodikone2-frontend/webpack.config.js +++ b/services/oodikone2-frontend/webpack.config.js @@ -11,6 +11,7 @@ const apiAddress = process.env.BACKEND_ADDR || 'localhost' const backendURL = `http://${apiAddress}:${apiServerPort}` const BASE_PATH = process.env.BASE_PATH || '/' const sentrydryrun = !Boolean(process.env.SENTRY_RELEASE_VERSION) +const sentryreleaseversion = sentrydryrun ? 'dryRun' : process.env.SENTRY_RELEASE_VERSION module.exports = (env, args) => { const { mode } = args @@ -73,7 +74,8 @@ module.exports = (env, args) => { USER_ADMINER_URL: JSON.stringify(process.env.USER_ADMINER_URL), ADMINER_URL: JSON.stringify(process.env.ADMINER_URL), KONE_ADMINER_URL: JSON.stringify(process.env.KONE_ADMINER_URL), - USAGE_ADMINER_URL: JSON.stringify(process.env.USAGE_ADMINER_URL) + USAGE_ADMINER_URL: JSON.stringify(process.env.USAGE_ADMINER_URL), + SENTRY_RELEASE_VERSION: JSON.stringify(sentryreleaseversion) } }), new MiniCssExtractPlugin({ @@ -84,7 +86,7 @@ module.exports = (env, args) => { include: 'dist', ignoreFile: '.sentrycliignore', ignore: ['node_modules', 'webpack.config.js'], - release: sentrydryrun ? 'dryRun' : process.env.SENTRY_RELEASE_VERSION, + release: sentryreleaseversion, dryRun: sentrydryrun }) ], From 196256b0194ed6e4b8780eaf59853e04e5a8cd38 Mon Sep 17 00:00:00 2001 From: Warro Date: Fri, 19 Jul 2019 10:39:05 +0300 Subject: [PATCH 4/4] Deleted 20190710_00_delete_me_after_release.js migration --- .../20190710_00_delete_me_after_release.js | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 services/backend/shared/migrations/20190710_00_delete_me_after_release.js diff --git a/services/backend/shared/migrations/20190710_00_delete_me_after_release.js b/services/backend/shared/migrations/20190710_00_delete_me_after_release.js deleted file mode 100644 index 154b54b536..0000000000 --- a/services/backend/shared/migrations/20190710_00_delete_me_after_release.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - up: async (queryInterface, Sequelize) => { - return queryInterface.sequelize.transaction(async transaction => { - await queryInterface.sequelize.query(` -INSERT INTO "migrations" ("name") VALUES -('20190710_01_trunkate_migrations.js'); -`, { transaction }) - }) - }, - down: async () => { - } -}