fix: attempts should be reloaded when quiz data changes (#790)

This commit is contained in:
Md Hussain Nagaria
2024-04-29 20:03:11 +05:30
committed by GitHub
parent e7d7cffbc5
commit 180140c13f

View File

@@ -253,8 +253,6 @@ const quiz = createResource({
if (data.shuffle_questions) { if (data.shuffle_questions) {
data.questions = data.questions.sort(() => Math.random() - 0.5) data.questions = data.questions.sort(() => Math.random() - 0.5)
} }
attempts.reload()
resetQuiz()
}, },
}) })
@@ -286,6 +284,16 @@ const attempts = createResource({
}, },
}) })
watch(
() => quiz.data,
() => {
if (quiz.data) {
attempts.reload()
resetQuiz()
}
}
)
const quizSubmission = createResource({ const quizSubmission = createResource({
url: 'lms.lms.doctype.lms_quiz.lms_quiz.quiz_summary', url: 'lms.lms.doctype.lms_quiz.lms_quiz.quiz_summary',
makeParams(values) { makeParams(values) {