-
Notifications
You must be signed in to change notification settings - Fork 709
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
reload on connect in quizsummarypage; avoid possible error w/ missing… #12554
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ | |
</KGrid> | ||
<ManageExamModals | ||
:currentAction="currentAction" | ||
:quiz="quiz" | ||
:quiz="exam" | ||
@submit_delete="handleSubmitDelete" | ||
@submit_copy="handleSubmitCopy" | ||
@cancel="closeModal" | ||
|
@@ -100,7 +100,7 @@ | |
import ExamResource from 'kolibri-common/apiResources/ExamResource'; | ||
import { enhancedQuizManagementStrings } from 'kolibri-common/strings/enhancedQuizManagementStrings'; | ||
import useSnackbar from 'kolibri/composables/useSnackbar'; | ||
import { PageNames } from '../../../constants'; | ||
import { convertExamQuestionSources } from 'kolibri-common/quizzes/utils'; | ||
import { QUIZZES_TABS_ID, QuizzesTabs } from '../../../constants/tabsConstants'; | ||
import { useCoachTabs } from '../../../composables/useCoachTabs'; | ||
|
||
|
@@ -148,19 +148,11 @@ | |
}, | ||
data() { | ||
return { | ||
quiz: { | ||
active: false, | ||
assignments: [], | ||
learners_see_fixed_order: false, | ||
question_sources: [], | ||
title: '', | ||
}, | ||
loading: true, | ||
currentAction: '', | ||
QUIZZES_TABS_ID, | ||
QuizzesTabs, | ||
difficultQuestions: [], | ||
PageNames, | ||
}; | ||
}, | ||
computed: { | ||
|
@@ -208,7 +200,7 @@ | |
|
||
tabsList.forEach(tab => { | ||
tab.to = this.classRoute( | ||
this.group ? PageNames.GROUP_EXAM_SUMMARY : PageNames.EXAM_SUMMARY, | ||
this.group ? this.PageNames.GROUP_EXAM_SUMMARY : this.PageNames.EXAM_SUMMARY, | ||
{ tabId: tab.id }, | ||
); | ||
}); | ||
|
@@ -260,8 +252,7 @@ | |
methods: { | ||
// @public | ||
setData(data) { | ||
const { exam, difficultQuestions } = data; | ||
this.quiz = exam; | ||
const { difficultQuestions } = data; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exam is removed here because we have a computed property |
||
this.difficultQuestions = difficultQuestions; | ||
this.loading = false; | ||
this.$store.dispatch('notLoading'); | ||
|
@@ -275,7 +266,7 @@ | |
setCurrentAction(action) { | ||
if (action === 'EDIT_DETAILS') { | ||
this.$router.push({ | ||
name: PageNames.EXAM_CREATION_ROOT, | ||
name: this.PageNames.EXAM_CREATION_ROOT, | ||
params: { ...this.$route.params, sectionIndex: 0 }, | ||
}); | ||
} else { | ||
|
@@ -285,7 +276,7 @@ | |
closeModal() { | ||
this.currentAction = ''; | ||
}, | ||
handleSubmitCopy({ classroomId, groupIds, adHocLearnerIds, examTitle }) { | ||
async handleSubmitCopy({ classroomId, groupIds, adHocLearnerIds, examTitle }) { | ||
const title = examTitle.trim().substring(0, 100).trim(); | ||
|
||
const assignments = serverAssignmentPayload(groupIds, classroomId); | ||
|
@@ -296,7 +287,8 @@ | |
collection: classroomId, | ||
assignments, | ||
learner_ids: adHocLearnerIds, | ||
question_sources: this.quiz.question_sources, | ||
// This ensures backward compatibility for all question_sources versions | ||
question_sources: (await convertExamQuestionSources(this.exam)).question_sources, | ||
}; | ||
|
||
ExamResource.saveModel({ data: newQuiz }) | ||
|
@@ -339,10 +331,10 @@ | |
}); | ||
}, | ||
handleSubmitDelete() { | ||
return deleteExam(this.quiz.id) | ||
return deleteExam(this.quizId) | ||
.then(() => { | ||
this.$store.commit('classSummary/DELETE_ITEM', { map: 'examMap', id: this.quiz.id }); | ||
this.$router.replace(this.classRoute(PageNames.EXAMS_ROOT), () => { | ||
this.$store.commit('classSummary/DELETE_ITEM', { map: 'examMap', id: this.quizId }); | ||
this.$router.replace(this.classRoute(this.PageNames.EXAMS_ROOT), () => { | ||
this.showSnackbarNotification('quizDeleted'); | ||
}); | ||
}) | ||
|
@@ -351,7 +343,7 @@ | |
}); | ||
}, | ||
detailLink(learnerId) { | ||
return this.classRoute(PageNames.QUIZ_LEARNER_PAGE_ROOT, { | ||
return this.classRoute(this.PageNames.QUIZ_LEARNER_PAGE_ROOT, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was weird to find but it's because we don't import PageNames here, but rather, we get it from the |
||
learnerId, | ||
}); | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This silences an error message