fix: misc issues
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
:class="isSidebarCollapsed ? 'items-center' : ''"
|
:class="isSidebarCollapsed ? 'items-center' : ''"
|
||||||
>
|
>
|
||||||
<UserDropdown class="p-2" :isCollapsed="isSidebarCollapsed" />
|
<UserDropdown class="p-2" :isCollapsed="isSidebarCollapsed" />
|
||||||
<div class="flex flex-col overflow-y-auto" v-if="sidebarSettings.data">
|
<div class="flex flex-col" v-if="sidebarSettings.data">
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
v-for="link in sidebarLinks"
|
v-for="link in sidebarLinks"
|
||||||
:link="link"
|
:link="link"
|
||||||
@@ -22,9 +22,13 @@
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="isModerator"
|
v-if="isModerator"
|
||||||
class="flex items-center justify-between pl-4 pr-2"
|
class="flex items-center justify-between pr-2"
|
||||||
|
:class="isSidebarCollapsed ? 'pl-3' : 'pl-5'"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
v-if="!isSidebarCollapsed"
|
||||||
|
class="text-sm font-medium text-gray-600"
|
||||||
>
|
>
|
||||||
<span class="text-sm font-medium text-gray-600">
|
|
||||||
{{ __('Web Pages') }}
|
{{ __('Web Pages') }}
|
||||||
</span>
|
</span>
|
||||||
<Button variant="ghost" @click="openPageModal()">
|
<Button variant="ghost" @click="openPageModal()">
|
||||||
@@ -35,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="sidebarSettings.data?.web_pages?.length"
|
v-if="sidebarSettings.data?.web_pages?.length"
|
||||||
class="flex flex-col overflow-y-auto"
|
class="flex flex-col"
|
||||||
>
|
>
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
v-for="link in sidebarSettings.data.web_pages"
|
v-for="link in sidebarSettings.data.web_pages"
|
||||||
|
|||||||
@@ -16,8 +16,7 @@
|
|||||||
{{ __('Live Class') }}
|
{{ __('Live Class') }}
|
||||||
</div>
|
</div>
|
||||||
<div v-if="liveClasses.data?.length" class="grid grid-cols-2 gap-5">
|
<div v-if="liveClasses.data?.length" class="grid grid-cols-2 gap-5">
|
||||||
<div v-for="cls in liveClasses.data">
|
<div v-for="cls in liveClasses.data" class="border rounded-md h-full p-3">
|
||||||
<div class="border rounded-md p-3">
|
|
||||||
<div class="font-semibold text-lg mb-4">
|
<div class="font-semibold text-lg mb-4">
|
||||||
{{ cls.title }}
|
{{ cls.title }}
|
||||||
</div>
|
</div>
|
||||||
@@ -56,7 +55,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div v-else class="text-sm italic text-gray-600">
|
<div v-else class="text-sm italic text-gray-600">
|
||||||
{{ __('No live classes scheduled') }}
|
{{ __('No live classes scheduled') }}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -138,7 +138,27 @@
|
|||||||
{{ questionDetails.data[`explanation_${index}`] }}
|
{{ questionDetails.data[`explanation_${index}`] }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center justify-between mt-8">
|
<div v-else>
|
||||||
|
<FormControl
|
||||||
|
v-model="possibleAnswer"
|
||||||
|
type="textarea"
|
||||||
|
:disabled="showAnswers.length ? true : false"
|
||||||
|
class="my-2"
|
||||||
|
/>
|
||||||
|
<div v-if="showAnswers.length">
|
||||||
|
<Badge v-if="showAnswers[0]" :label="__('Correct')" theme="green">
|
||||||
|
<template #prefix>
|
||||||
|
<CheckCircle class="w-4 h-4 text-green-500 mr-1" />
|
||||||
|
</template>
|
||||||
|
</Badge>
|
||||||
|
<Badge v-else theme="red" :label="__('Incorrect')">
|
||||||
|
<template #prefix>
|
||||||
|
<XCircle class="w-4 h-4 text-red-500 mr-1" />
|
||||||
|
</template>
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center justify-between mt-5">
|
||||||
<div>
|
<div>
|
||||||
{{
|
{{
|
||||||
__('Question {0} of {1}').format(
|
__('Question {0} of {1}').format(
|
||||||
@@ -215,22 +235,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { Badge, Button, createResource, ListView } from 'frappe-ui'
|
||||||
createDocumentResource,
|
|
||||||
Button,
|
|
||||||
createResource,
|
|
||||||
ListView,
|
|
||||||
} from 'frappe-ui'
|
|
||||||
import { ref, watch, reactive, inject } from 'vue'
|
import { ref, watch, reactive, inject } from 'vue'
|
||||||
import { createToast } from '@/utils/'
|
import { createToast } from '@/utils/'
|
||||||
import { CheckCircle, XCircle, MinusCircle } from 'lucide-vue-next'
|
import { CheckCircle, XCircle, MinusCircle } from 'lucide-vue-next'
|
||||||
import { timeAgo } from '@/utils'
|
import { timeAgo } from '@/utils'
|
||||||
|
import FormControl from 'frappe-ui/src/components/FormControl.vue'
|
||||||
const user = inject('$user')
|
const user = inject('$user')
|
||||||
|
|
||||||
const activeQuestion = ref(0)
|
const activeQuestion = ref(0)
|
||||||
const currentQuestion = ref('')
|
const currentQuestion = ref('')
|
||||||
const selectedOptions = reactive([0, 0, 0, 0])
|
const selectedOptions = reactive([0, 0, 0, 0])
|
||||||
const showAnswers = reactive([])
|
const showAnswers = reactive([])
|
||||||
|
const possibleAnswer = ref(null)
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
quizName: {
|
quizName: {
|
||||||
@@ -342,10 +359,17 @@ const markAnswer = (index) => {
|
|||||||
|
|
||||||
const getAnswers = () => {
|
const getAnswers = () => {
|
||||||
let answers = []
|
let answers = []
|
||||||
|
const type = questionDetails.data.type
|
||||||
|
|
||||||
|
if (type == 'Choices') {
|
||||||
selectedOptions.forEach((value, index) => {
|
selectedOptions.forEach((value, index) => {
|
||||||
if (selectedOptions[index])
|
if (selectedOptions[index])
|
||||||
answers.push(questionDetails.data[`option_${index + 1}`])
|
answers.push(questionDetails.data[`option_${index + 1}`])
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
answers.push(possibleAnswer.value)
|
||||||
|
}
|
||||||
|
|
||||||
return answers
|
return answers
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,6 +394,8 @@ const checkAnswer = () => {
|
|||||||
},
|
},
|
||||||
auto: true,
|
auto: true,
|
||||||
onSuccess(data) {
|
onSuccess(data) {
|
||||||
|
let type = questionDetails.data.type
|
||||||
|
if (type == 'Choices') {
|
||||||
selectedOptions.forEach((option, index) => {
|
selectedOptions.forEach((option, index) => {
|
||||||
if (option) {
|
if (option) {
|
||||||
showAnswers[index] = option && data[index]
|
showAnswers[index] = option && data[index]
|
||||||
@@ -379,6 +405,9 @@ const checkAnswer = () => {
|
|||||||
showAnswers[index] = undefined
|
showAnswers[index] = undefined
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
showAnswers.push(data)
|
||||||
|
}
|
||||||
addToLocalStorage()
|
addToLocalStorage()
|
||||||
if (!quiz.data.show_answers) {
|
if (!quiz.data.show_answers) {
|
||||||
resetQuestion()
|
resetQuestion()
|
||||||
@@ -413,6 +442,7 @@ const resetQuestion = () => {
|
|||||||
activeQuestion.value = activeQuestion.value + 1
|
activeQuestion.value = activeQuestion.value + 1
|
||||||
selectedOptions.splice(0, selectedOptions.length, ...[0, 0, 0, 0])
|
selectedOptions.splice(0, selectedOptions.length, ...[0, 0, 0, 0])
|
||||||
showAnswers.length = 0
|
showAnswers.length = 0
|
||||||
|
possibleAnswer.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitQuiz = () => {
|
const submitQuiz = () => {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
{{ link.count }}
|
{{ link.count }}
|
||||||
</span>
|
</span>
|
||||||
<div
|
<div
|
||||||
v-if="showControls"
|
v-if="showControls && !isCollapsed"
|
||||||
class="flex items-center space-x-2 !ml-auto block text-xs text-gray-600 group-hover:visible invisible"
|
class="flex items-center space-x-2 !ml-auto block text-xs text-gray-600 group-hover:visible invisible"
|
||||||
>
|
>
|
||||||
<component
|
<component
|
||||||
@@ -77,7 +77,7 @@ const props = defineProps({
|
|||||||
function handleClick() {
|
function handleClick() {
|
||||||
if (router.hasRoute(props.link.to)) {
|
if (router.hasRoute(props.link.to)) {
|
||||||
router.push({ name: props.link.to })
|
router.push({ name: props.link.to })
|
||||||
} else {
|
} else if (props.link.to) {
|
||||||
window.location.href = `/${props.link.to}`
|
window.location.href = `/${props.link.to}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import frappe
|
|||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import cstr, comma_and
|
from frappe.utils import cstr, comma_and
|
||||||
|
from fuzzywuzzy import fuzz
|
||||||
from lms.lms.doctype.course_lesson.course_lesson import save_progress
|
from lms.lms.doctype.course_lesson.course_lesson import save_progress
|
||||||
from lms.lms.utils import (
|
from lms.lms.utils import (
|
||||||
generate_slug,
|
generate_slug,
|
||||||
@@ -304,7 +305,7 @@ def check_input_answers(question, answer):
|
|||||||
question_details = frappe.db.get_value("LMS Question", question, fields, as_dict=1)
|
question_details = frappe.db.get_value("LMS Question", question, fields, as_dict=1)
|
||||||
for num in range(1, 5):
|
for num in range(1, 5):
|
||||||
current_possibility = question_details[f"possibility_{num}"]
|
current_possibility = question_details[f"possibility_{num}"]
|
||||||
if current_possibility and current_possibility.lower() == answer.lower():
|
if current_possibility and fuzz.token_sort_ratio(current_possibility, answer) > 85:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -1213,6 +1213,7 @@ def create_membership(course, payment):
|
|||||||
|
|
||||||
def add_student_to_batch(batchname, payment):
|
def add_student_to_batch(batchname, payment):
|
||||||
student = frappe.new_doc("Batch Student")
|
student = frappe.new_doc("Batch Student")
|
||||||
|
current_count = frappe.db.count("Batch Student", {"parent": batchname})
|
||||||
student.update(
|
student.update(
|
||||||
{
|
{
|
||||||
"student": frappe.session.user,
|
"student": frappe.session.user,
|
||||||
@@ -1221,6 +1222,7 @@ def add_student_to_batch(batchname, payment):
|
|||||||
"parent": batchname,
|
"parent": batchname,
|
||||||
"parenttype": "LMS Batch",
|
"parenttype": "LMS Batch",
|
||||||
"parentfield": "students",
|
"parentfield": "students",
|
||||||
|
"idx": current_count + 1,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
student.save(ignore_permissions=True)
|
student.save(ignore_permissions=True)
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ dependencies = [
|
|||||||
"beautifulsoup4~=4.12.2",
|
"beautifulsoup4~=4.12.2",
|
||||||
"lxml~=4.9.3",
|
"lxml~=4.9.3",
|
||||||
"cairocffi~=1.6.1",
|
"cairocffi~=1.6.1",
|
||||||
"razorpay~=1.4.1"
|
"razorpay~=1.4.1",
|
||||||
|
"fuzzywuzzy~=0.18.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
|
|||||||
Reference in New Issue
Block a user