@@ -219,7 +219,6 @@ watch(userResource, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const toggleSidebar = () => {
|
const toggleSidebar = () => {
|
||||||
console.log(sidebarStore.isSidebarCollapsed)
|
|
||||||
sidebarStore.isSidebarCollapsed = !sidebarStore.isSidebarCollapsed
|
sidebarStore.isSidebarCollapsed = !sidebarStore.isSidebarCollapsed
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -16,12 +16,7 @@
|
|||||||
>
|
>
|
||||||
<template #body-content>
|
<template #body-content>
|
||||||
<div class="space-y-4 text-base">
|
<div class="space-y-4 text-base">
|
||||||
<FormControl
|
<FormControl label="Title" v-model="chapter.title" :required="true" />
|
||||||
ref="chapterInput"
|
|
||||||
label="Title"
|
|
||||||
v-model="chapter.title"
|
|
||||||
:required="true"
|
|
||||||
/>
|
|
||||||
<FormControl
|
<FormControl
|
||||||
:label="__('Is SCORM Package')"
|
:label="__('Is SCORM Package')"
|
||||||
v-model="chapter.is_scorm_package"
|
v-model="chapter.is_scorm_package"
|
||||||
@@ -83,7 +78,6 @@ import { FileText, X } from 'lucide-vue-next'
|
|||||||
|
|
||||||
const show = defineModel()
|
const show = defineModel()
|
||||||
const outline = defineModel('outline')
|
const outline = defineModel('outline')
|
||||||
const chapterInput = ref(null)
|
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
course: {
|
course: {
|
||||||
@@ -209,14 +203,6 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
/* watch(show, () => {
|
|
||||||
if (show.value) {
|
|
||||||
setTimeout(() => {
|
|
||||||
chapterInput.value.$el.querySelector('input').focus()
|
|
||||||
}, 100)
|
|
||||||
}
|
|
||||||
}) */
|
|
||||||
|
|
||||||
const validateFile = (file) => {
|
const validateFile = (file) => {
|
||||||
let extension = file.name.split('.').pop().toLowerCase()
|
let extension = file.name.split('.').pop().toLowerCase()
|
||||||
if (extension !== 'zip') {
|
if (extension !== 'zip') {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
id="existing"
|
id="existing"
|
||||||
value="existing"
|
value="existing"
|
||||||
v-model="questionType"
|
v-model="questionType"
|
||||||
class="w-3 h-3 accent-gray-900"
|
class="w-3 h-3 cursor-pointer"
|
||||||
/>
|
/>
|
||||||
<label for="existing">
|
<label for="existing" class="cursor-pointer">
|
||||||
{{ __('Add an existing question') }}
|
{{ __('Add an existing question') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,9 +25,9 @@
|
|||||||
id="new"
|
id="new"
|
||||||
value="new"
|
value="new"
|
||||||
v-model="questionType"
|
v-model="questionType"
|
||||||
class="w-3 h-3"
|
class="w-3 h-3 cursor-pointer"
|
||||||
/>
|
/>
|
||||||
<label for="new">
|
<label for="new" class="cursor-pointer">
|
||||||
{{ __('Create a new question') }}
|
{{ __('Create a new question') }}
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -127,7 +127,7 @@ const populateFields = () => {
|
|||||||
let counter = 1
|
let counter = 1
|
||||||
fields.forEach((field) => {
|
fields.forEach((field) => {
|
||||||
while (counter <= 4) {
|
while (counter <= 4) {
|
||||||
question[`${field}_${counter}`] = field === 'is_correct' ? false : ''
|
question[`${field}_${counter}`] = field === 'is_correct' ? false : null
|
||||||
counter++
|
counter++
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
</div>
|
</div>
|
||||||
<router-link
|
<router-link
|
||||||
|
v-if="user.data?.is_moderator || user.data?.is_instructor"
|
||||||
:to="{
|
:to="{
|
||||||
name: 'CourseForm',
|
name: 'CourseForm',
|
||||||
params: {
|
params: {
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<Button v-if="user.data?.is_moderator" variant="solid">
|
<Button variant="solid">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<Plus class="h-4 w-4" />
|
<Plus class="h-4 w-4" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -141,6 +141,7 @@
|
|||||||
v-slot="{ idx, column, item }"
|
v-slot="{ idx, column, item }"
|
||||||
v-for="row in quiz.questions"
|
v-for="row in quiz.questions"
|
||||||
@click="openQuestionModal(row)"
|
@click="openQuestionModal(row)"
|
||||||
|
class="cursor-pointer"
|
||||||
>
|
>
|
||||||
<ListRowItem :item="item">
|
<ListRowItem :item="item">
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -65,11 +65,11 @@ onBeforeMount(() => {
|
|||||||
Initialize: () => 'true',
|
Initialize: () => 'true',
|
||||||
Terminate: () => 'true',
|
Terminate: () => 'true',
|
||||||
GetValue: (key) => {
|
GetValue: (key) => {
|
||||||
console.log(`GetValue called for key: ${key}`)
|
console.log(`GET: ${key}`)
|
||||||
return getDataFromLMS(key)
|
return getDataFromLMS(key)
|
||||||
},
|
},
|
||||||
SetValue: (key, value) => {
|
SetValue: (key, value) => {
|
||||||
console.log(`SetValue called for key: ${key} to value: ${value}`)
|
console.log(`SET: ${key} to value: ${value}`)
|
||||||
|
|
||||||
saveDataToLMS(key, value)
|
saveDataToLMS(key, value)
|
||||||
return 'true'
|
return 'true'
|
||||||
@@ -96,7 +96,6 @@ onBeforeMount(() => {
|
|||||||
LMSGetErrorString: () => '',
|
LMSGetErrorString: () => '',
|
||||||
LMSGetDiagnostic: () => '',
|
LMSGetDiagnostic: () => '',
|
||||||
}
|
}
|
||||||
console.log(window.API_1484_11)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const getDataFromLMS = (key) => {
|
const getDataFromLMS = (key) => {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class LMSQuestion(Document):
|
|||||||
def validate_correct_answers(question):
|
def validate_correct_answers(question):
|
||||||
if question.type == "Choices":
|
if question.type == "Choices":
|
||||||
validate_duplicate_options(question)
|
validate_duplicate_options(question)
|
||||||
|
validate_minimum_options(question)
|
||||||
validate_correct_options(question)
|
validate_correct_options(question)
|
||||||
elif question.type == "User Input":
|
elif question.type == "User Input":
|
||||||
validate_possible_answer(question)
|
validate_possible_answer(question)
|
||||||
@@ -42,6 +43,11 @@ def validate_correct_options(question):
|
|||||||
frappe.throw(_("At least one option must be correct for this question."))
|
frappe.throw(_("At least one option must be correct for this question."))
|
||||||
|
|
||||||
|
|
||||||
|
def validate_minimum_options(question):
|
||||||
|
if question.type == "Choices" and (not question.option_1 or not question.option_2):
|
||||||
|
frappe.throw(_("Minimum two options are required for multiple choice questions."))
|
||||||
|
|
||||||
|
|
||||||
def validate_possible_answer(question):
|
def validate_possible_answer(question):
|
||||||
possible_answers = []
|
possible_answers = []
|
||||||
possible_answers_fields = [
|
possible_answers_fields = [
|
||||||
|
|||||||
Reference in New Issue
Block a user