Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EQM: On first save, update the quiz's ID when redirecting #12283

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,16 @@
},
});
} else {
if (this.$route.params.quizId === exam.id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should remove this - but we should coerce them both to strings for the comparison because for draft exams the exam.id will be an integer, but the route parameter will be a string.

When I did a subsequent save, not having this here led me to get a redundant navigation error from the replace below.

return;
}
this.$router.replace({
name: PageNames.EXAM_CREATION_ROOT,
params: {
classId: this.$route.params.classId,
quizId: exam.id,
},
});
// Update the quiz with the new id - there won't be if this is a new quiz,
// this ensures the quiz is kept up-to-date since we're replacing the route
this.updateQuiz({ id: exam.id });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems right - although maybe this should live inside the useQuizCreation composable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried putting it at the end of saveQuiz but it wasn't working so I tried this... I think that maybe the issue was that I wasn't returning the exam in the then callback on the ExamResource.saveModel -- I've pushed an update that seems to work better there.

}
})
.catch(error => {
Expand Down