From 9054f850447882ba0e3d94c7449f52e7df404d3f Mon Sep 17 00:00:00 2001
From: Jacob Pierce
Date: Mon, 26 Aug 2024 13:51:07 -0700
Subject: [PATCH] only load the quiz data once for quiz summary page
---
.../src/views/plan/QuizSummaryPage/index.vue | 38 +++++++------------
1 file changed, 13 insertions(+), 25 deletions(-)
diff --git a/kolibri/plugins/coach/assets/src/views/plan/QuizSummaryPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/QuizSummaryPage/index.vue
index 94f3be4f4ff..860d06053fc 100644
--- a/kolibri/plugins/coach/assets/src/views/plan/QuizSummaryPage/index.vue
+++ b/kolibri/plugins/coach/assets/src/views/plan/QuizSummaryPage/index.vue
@@ -46,7 +46,7 @@
@@ -55,7 +55,7 @@
{
+ return this.exam.question_sources.reduce((acc, section) => {
acc = [...acc, ...section.questions];
return acc;
}, []);
},
quizIsRandomized() {
- return !this.quiz.learners_see_fixed_order;
+ return !this.exam.learners_see_fixed_order;
},
avgScore() {
return this.getExamAvgScore(this.$route.params.quizId, this.recipients);
@@ -150,20 +139,19 @@
},
},
created() {
- return fetchQuizSummaryPageData(this.$route.params.quizId)
+ fetchExamWithContent(this.exam)
.then(data => {
this.setData(data);
})
- .catch(error => {
- this.setError(error);
+ .catch(e => {
+ this.setError(e);
});
},
methods: {
// @public
setData(data) {
- const { exam, exerciseContentNodes } = data;
- this.quiz = exam;
- this.selectedExercises = fromPairs(exerciseContentNodes.map(x => [x.id, x]));
+ const { exam, exercises } = data;
+ this.selectedExercises = fromPairs(exercises.map(x => [x.id, x]));
this.loading = false;
this.$store.dispatch('notLoading');
},
@@ -197,7 +185,7 @@
collection: classroomId,
assignments,
learner_ids: adHocLearnerIds,
- question_sources: this.quiz.question_sources,
+ question_sources: this.exam.question_sources,
};
ExamResource.saveModel({ data: newQuiz })
@@ -242,7 +230,7 @@
handleSubmitDelete() {
return deleteExam(this.$route.params.quizId)
.then(() => {
- this.$store.commit('classSummary/DELETE_ITEM', { map: 'examMap', id: this.quiz.id });
+ this.$store.commit('classSummary/DELETE_ITEM', { map: 'examMap', id: this.exam.id });
this.$router.replace(this.$router.getRoute('EXAMS'), () => {
this.showSnackbarNotification('quizDeleted');
});