Merge pull request #782 from pateljannat/quiz-shuffle
feat: quiz shuffle
This commit is contained in:
@@ -17,78 +17,61 @@
|
|||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4">
|
||||||
<div class="grid grid-cols-2 gap-4">
|
<div class="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<div class="mb-4">
|
<FormControl
|
||||||
<div class="mb-1.5 text-sm text-gray-600">
|
type="text"
|
||||||
{{ __('Title') }}
|
v-model="liveClass.title"
|
||||||
</div>
|
:label="__('Title')"
|
||||||
<Input type="text" v-model="liveClass.title" />
|
class="mb-4"
|
||||||
</div>
|
/>
|
||||||
<div class="mb-4">
|
<Tooltip
|
||||||
<div class="mb-1.5 text-sm text-gray-600">
|
:text="
|
||||||
<Tooltip
|
__(
|
||||||
class="flex items-center"
|
'Time must be in 24 hour format (HH:mm). Example 11:30 or 22:00'
|
||||||
:text="
|
)
|
||||||
__(
|
"
|
||||||
'Time must be in 24 hour format (HH:mm). Example 11:30 or 22:00'
|
>
|
||||||
)
|
<FormControl
|
||||||
"
|
v-model="liveClass.time"
|
||||||
>
|
type="time"
|
||||||
<span>
|
:label="__('Time')"
|
||||||
{{ __('Time') }}
|
class="mb-4"
|
||||||
</span>
|
|
||||||
<Info class="stroke-2 w-3 h-3 ml-1" />
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
<Input v-model="liveClass.time" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="mb-1.5 text-sm text-gray-600">
|
|
||||||
{{ __('Timezone') }}
|
|
||||||
</div>
|
|
||||||
<Select
|
|
||||||
v-model="liveClass.timezone"
|
|
||||||
:options="getTimezoneOptions()"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</Tooltip>
|
||||||
|
<FormControl
|
||||||
|
v-model="liveClass.timezone"
|
||||||
|
type="select"
|
||||||
|
:options="getTimezoneOptions()"
|
||||||
|
:label="__('Timezone')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="mb-4">
|
<FormControl
|
||||||
<div class="mb-1.5 text-sm text-gray-600">
|
v-model="liveClass.date"
|
||||||
{{ __('Date') }}
|
type="date"
|
||||||
</div>
|
class="mb-4"
|
||||||
<DatePicker v-model="liveClass.date" inputClass="w-full" />
|
:label="__('Date')"
|
||||||
</div>
|
/>
|
||||||
<div class="mb-4">
|
<Tooltip :text="__('Duration of the live class in minutes')">
|
||||||
<div class="mb-1.5 text-sm text-gray-600">
|
<FormControl
|
||||||
<Tooltip
|
type="number"
|
||||||
class="flex items-center"
|
v-model="liveClass.duration"
|
||||||
:text="__('Duration of the live class in minutes')"
|
:label="__('Duration')"
|
||||||
>
|
class="mb-4"
|
||||||
<span>
|
|
||||||
{{ __('Duration') }}
|
|
||||||
</span>
|
|
||||||
<Info class="stroke-2 w-3 h-3 ml-1" />
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
<Input type="number" v-model="liveClass.duration" />
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="mb-1.5 text-sm text-gray-600">
|
|
||||||
{{ __('Auto Recording') }}
|
|
||||||
</div>
|
|
||||||
<Select
|
|
||||||
v-model="liveClass.auto_recording"
|
|
||||||
:options="getRecordingOptions()"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</Tooltip>
|
||||||
|
<FormControl
|
||||||
|
v-model="liveClass.auto_recording"
|
||||||
|
type="select"
|
||||||
|
:options="getRecordingOptions()"
|
||||||
|
:label="__('Auto Recording')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<FormControl
|
||||||
<div class="mb-1.5 text-sm text-gray-600">
|
v-model="liveClass.description"
|
||||||
{{ __('Description') }}
|
type="textarea"
|
||||||
</div>
|
:label="__('Description')"
|
||||||
<Textarea v-model="liveClass.description" />
|
/>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -102,6 +85,7 @@ import {
|
|||||||
Dialog,
|
Dialog,
|
||||||
createResource,
|
createResource,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
|
FormControl,
|
||||||
} from 'frappe-ui'
|
} from 'frappe-ui'
|
||||||
import { reactive, inject } from 'vue'
|
import { reactive, inject } from 'vue'
|
||||||
import { getTimezones, createToast } from '@/utils/'
|
import { getTimezones, createToast } from '@/utils/'
|
||||||
|
|||||||
@@ -124,13 +124,16 @@
|
|||||||
<MinusCircle v-else class="w-4 h-4" />
|
<MinusCircle v-else class="w-4 h-4" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span class="ml-2">
|
<span
|
||||||
{{ questionDetails.data[`option_${index}`] }}
|
class="ml-2"
|
||||||
|
v-html="questionDetails.data[`option_${index}`]"
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<div
|
<div
|
||||||
v-if="questionDetails.data[`explanation_${index}`]"
|
v-if="questionDetails.data[`explanation_${index}`]"
|
||||||
class="mt-2 text-sm hidden"
|
class="mt-2 text-xs"
|
||||||
|
v-show="showAnswers.length"
|
||||||
>
|
>
|
||||||
{{ questionDetails.data[`explanation_${index}`] }}
|
{{ questionDetails.data[`explanation_${index}`] }}
|
||||||
</div>
|
</div>
|
||||||
@@ -247,6 +250,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()
|
||||||
},
|
},
|
||||||
@@ -342,7 +348,8 @@ const checkAnswer = () => {
|
|||||||
createToast({
|
createToast({
|
||||||
title: 'Please select an option',
|
title: 'Please select an option',
|
||||||
icon: 'alert-circle',
|
icon: 'alert-circle',
|
||||||
iconClasses: 'text-yellow-600 bg-yellow-100',
|
iconClasses: 'text-yellow-600 bg-yellow-100 rounded-full',
|
||||||
|
position: 'top-center',
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,8 @@ const props = defineProps({
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const redirectToLogin = () => {
|
||||||
|
window.location.href = `/login`
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ def remove_assessment(assessment, parent):
|
|||||||
def create_live_class(
|
def create_live_class(
|
||||||
batch_name, title, duration, date, time, timezone, auto_recording, description=None
|
batch_name, title, duration, date, time, timezone, auto_recording, description=None
|
||||||
):
|
):
|
||||||
date = format_date(date, "yyyy-mm-dd", True)
|
|
||||||
frappe.only_for("Moderator")
|
frappe.only_for("Moderator")
|
||||||
payload = {
|
payload = {
|
||||||
"topic": title,
|
"topic": title,
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user