feat: quiz shuffle

This commit is contained in:
Jannat Patel
2024-04-24 12:51:01 +05:30
parent 804fc8e391
commit c3390b9005
2 changed files with 23 additions and 7 deletions

View File

@@ -247,6 +247,9 @@ const quiz = createResource({
cache: ['quiz', props.quizName], cache: ['quiz', props.quizName],
auto: true, auto: true,
onSuccess(data) { onSuccess(data) {
if (data.shuffle_questions) {
data.questions = data.questions.sort(() => Math.random() - 0.5)
}
attempts.reload() attempts.reload()
resetQuiz() resetQuiz()
}, },

View File

@@ -8,14 +8,16 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"title", "title",
"show_answers", "passing_percentage",
"column_break_gaac", "column_break_gaac",
"max_attempts", "max_attempts",
"show_submission_history",
"section_break_hsiv",
"passing_percentage",
"column_break_rocd",
"total_marks", "total_marks",
"section_break_hsiv",
"show_answers",
"column_break_rocd",
"show_submission_history",
"column_break_dsup",
"shuffle_questions",
"section_break_sbjx", "section_break_sbjx",
"questions", "questions",
"section_break_3", "section_break_3",
@@ -97,7 +99,8 @@
}, },
{ {
"fieldname": "section_break_hsiv", "fieldname": "section_break_hsiv",
"fieldtype": "Section Break" "fieldtype": "Section Break",
"label": "Settings"
}, },
{ {
"fieldname": "passing_percentage", "fieldname": "passing_percentage",
@@ -118,11 +121,21 @@
"non_negative": 1, "non_negative": 1,
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
},
{
"fieldname": "column_break_dsup",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "shuffle_questions",
"fieldtype": "Check",
"label": "Shuffle Questions"
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2024-02-27 13:04:00.785182", "modified": "2024-04-24 12:37:20.578041",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "LMS Quiz", "name": "LMS Quiz",