diff --git a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js index 5f6bcc78660..db84ccd1b98 100644 --- a/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js +++ b/kolibri/plugins/coach/assets/src/composables/useQuizCreation.js @@ -323,7 +323,12 @@ export default function useQuizCreation() { finalQuiz.question_sources = questionSourcesWithoutResourcePool; } - return ExamResource.saveModel({ id, data: finalQuiz }); + return ExamResource.saveModel({ id, data: finalQuiz }).then(exam => { + if (id !== exam.id) { + updateQuiz({ id: exam.id }); + } + return exam; + }); } /** 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 a875e96290f..ce2edea2e23 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/index.vue @@ -174,7 +174,7 @@ }, }); } else { - if (this.$route.params.quizId === exam.id) { + if (String(this.$route.params.quizId) === String(exam.id)) { return; } this.$router.replace({ diff --git a/kolibri/plugins/coach/assets/test/useQuizCreation.spec.js b/kolibri/plugins/coach/assets/test/useQuizCreation.spec.js index c21ffd26f35..4a022eaf070 100644 --- a/kolibri/plugins/coach/assets/test/useQuizCreation.spec.js +++ b/kolibri/plugins/coach/assets/test/useQuizCreation.spec.js @@ -30,7 +30,7 @@ const { const _channel = { root: 'channel_1', name: 'Channel 1', kind: 'channel', is_leaf: false }; ChannelResource.fetchCollection = jest.fn(() => Promise.resolve([_channel])); -ExamResource.saveModel = jest.fn(() => Promise.resolve()); +ExamResource.saveModel = jest.fn(() => Promise.resolve({})); /** * @param num {number} - The number of questions to create