From f3700ca2dc6af8ec4ef55daee3d3f13c52a6e4f4 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Fri, 12 Jul 2024 00:36:17 +0300 Subject: [PATCH 1/7] fixes the route --- .../assets/src/views/plan/CoachExamsPage/index.vue | 7 ++++++- .../assets/src/views/plan/CreateExamPage/index.vue | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue index 7660bb47b3c..6faa2349936 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue @@ -406,7 +406,12 @@ SELECT_QUIZ: PageNames.QUIZ_SELECT_PRACTICE_QUIZ, }[value]; nextRoute.name = nextRouteName; - this.$router.push(nextRoute); + if(nextRoute.name ===PageNames.EXAM_CREATION_ROOT){ + + this.$router.push(nextRoute); + }else{ + this.$router.replace(nextRoute); + } }, }, $trs: { diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 05145d8d3df..0a4d14e2ce4 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -245,6 +245,18 @@ } }, beforeRouteUpdate(to, from, next) { + if(to.name === PageNames.QUIZ_SELECT_PRACTICE_QUIZ && + from.name === PageNames.EXAM_CREATION_ROOT){ + this.closeConfirmationToRoute = to; + next({ + name: PageNames.EXAMS, + params: { + classId: to.params.classId, + }, + }); + } + + if (to.params.sectionIndex >= this.allSections.length) { next({ name: PageNames.EXAM_CREATION_ROOT, From 58d0f98f2102fbd9355696901b310fc10df66331 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Sat, 13 Jul 2024 01:08:42 +0300 Subject: [PATCH 2/7] updates route guard --- kolibri/plugins/coach/assets/src/app.js | 1 + .../coach/assets/src/views/plan/CreateExamPage/index.vue | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/app.js b/kolibri/plugins/coach/assets/src/app.js index c930f5b09e7..b578d6d0cd1 100644 --- a/kolibri/plugins/coach/assets/src/app.js +++ b/kolibri/plugins/coach/assets/src/app.js @@ -36,6 +36,7 @@ class CoachToolsModule extends KolibriApp { PageNames.EXAM_CREATION_ROOT, PageNames.QUIZ_SECTION_EDITOR, PageNames.QUIZ_REPLACE_QUESTIONS, + PageNames.QUIZ_SELECT_PRACTICE_QUIZ, PageNames.QUIZ_SELECT_RESOURCES, PageNames.BOOK_MARKED_RESOURCES, pages.ReportsQuizLearnerPage.name, diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 0a4d14e2ce4..3972183cc1e 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -247,16 +247,15 @@ beforeRouteUpdate(to, from, next) { if(to.name === PageNames.QUIZ_SELECT_PRACTICE_QUIZ && from.name === PageNames.EXAM_CREATION_ROOT){ - this.closeConfirmationToRoute = to; - next({ + this.closeConfirmationToRoute = { name: PageNames.EXAMS, params: { classId: to.params.classId, }, - }); + }; + next(false); + return; } - - if (to.params.sectionIndex >= this.allSections.length) { next({ name: PageNames.EXAM_CREATION_ROOT, From 9fb2414843058f45705d78b6814f893df04a6065 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Sat, 13 Jul 2024 01:28:12 +0300 Subject: [PATCH 3/7] restore handleselect function logic --- .../coach/assets/src/views/plan/CoachExamsPage/index.vue | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue index 6faa2349936..7660bb47b3c 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CoachExamsPage/index.vue @@ -406,12 +406,7 @@ SELECT_QUIZ: PageNames.QUIZ_SELECT_PRACTICE_QUIZ, }[value]; nextRoute.name = nextRouteName; - if(nextRoute.name ===PageNames.EXAM_CREATION_ROOT){ - - this.$router.push(nextRoute); - }else{ - this.$router.replace(nextRoute); - } + this.$router.push(nextRoute); }, }, $trs: { From 32d81de328a0d397d378298aa4a2b0c09d43eff3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 22:33:00 +0000 Subject: [PATCH 4/7] [pre-commit.ci lite] apply automatic fixes --- .../coach/assets/src/views/plan/CreateExamPage/index.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 3972183cc1e..49dcf6fa92a 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -245,8 +245,10 @@ } }, beforeRouteUpdate(to, from, next) { - if(to.name === PageNames.QUIZ_SELECT_PRACTICE_QUIZ && - from.name === PageNames.EXAM_CREATION_ROOT){ + if ( + to.name === PageNames.QUIZ_SELECT_PRACTICE_QUIZ && + from.name === PageNames.EXAM_CREATION_ROOT + ) { this.closeConfirmationToRoute = { name: PageNames.EXAMS, params: { From ba094b5ad37af4fec025b572b70bcdc7b84f0df6 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Sat, 13 Jul 2024 01:45:48 +0300 Subject: [PATCH 5/7] prevents reloading modal from over popping on browser --- .../coach/assets/src/views/plan/CreateExamPage/index.vue | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 49dcf6fa92a..c0ccb6293d3 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -300,6 +300,9 @@ } this.quizInitialized = true; }, + destroy() { + window.removeEventListener('beforeunload', this.onBeforeUnload) + }, methods: { beforeUnload(e) { if (this.quizHasChanged) { From 27019b59a03b2bb380379f495ac0766caacbf526 Mon Sep 17 00:00:00 2001 From: Allan Otodi Opeto <103313919+AllanOXDi@users.noreply.github.com> Date: Sat, 13 Jul 2024 01:49:42 +0300 Subject: [PATCH 6/7] fixes typo --- .../coach/assets/src/views/plan/CreateExamPage/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index c0ccb6293d3..06515e4aa1d 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -301,7 +301,7 @@ this.quizInitialized = true; }, destroy() { - window.removeEventListener('beforeunload', this.onBeforeUnload) + window.removeEventListener('beforeunload', this.beforeUnload) }, methods: { beforeUnload(e) { From b88e65e28046509ba756d1029b5062ad9453d06e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Fri, 12 Jul 2024 22:52:37 +0000 Subject: [PATCH 7/7] [pre-commit.ci lite] apply automatic fixes --- .../coach/assets/src/views/plan/CreateExamPage/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue index 06515e4aa1d..047ba4db881 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -301,7 +301,7 @@ this.quizInitialized = true; }, destroy() { - window.removeEventListener('beforeunload', this.beforeUnload) + window.removeEventListener('beforeunload', this.beforeUnload); }, methods: { beforeUnload(e) {