Merge pull request #1809 from pateljannat/issues-143

fix: resolved the issue that appeared when adding a chapter
This commit is contained in:
Jannat Patel
2025-10-27 11:50:25 +05:30
committed by GitHub
9 changed files with 516 additions and 1881 deletions

View File

@@ -3,7 +3,7 @@
class="flex flex-col border rounded-md p-3 h-full hover:border-outline-gray-3"
>
<div class="flex space-x-4 mb-4">
<div class="flex flex-col space-y-2 flex-1">
<div class="flex flex-col space-y-2 flex-1 break-all">
<div class="text-lg font-semibold text-ink-gray-9">
{{ job.company_name }}
</div>

View File

@@ -126,7 +126,7 @@ import {
Button,
toast,
} from 'frappe-ui'
import { computed, watch, reactive, ref, inject } from 'vue'
import { watch, reactive, ref, inject } from 'vue'
import Link from '@/components/Controls/Link.vue'
import { useOnboarding } from 'frappe-ui/frappe'
@@ -141,6 +141,7 @@ const existingQuestion = reactive({
question: '',
marks: 1,
})
const question = reactive({
question: '',
type: 'Choices',

View File

@@ -329,7 +329,6 @@
<script setup>
import {
Breadcrumbs,
call,
TextEditor,
Button,
createResource,

View File

@@ -158,7 +158,7 @@ import { computed, onMounted, reactive, inject } from 'vue'
import { FileText, X } from 'lucide-vue-next'
import { sessionStore } from '@/stores/session'
import { useRouter } from 'vue-router'
import { getFileSize, validateFile } from '@/utils'
import { escapeHTML, getFileSize, validateFile } from '@/utils'
const user = inject('$user')
const router = useRouter()
@@ -248,6 +248,7 @@ onMounted(() => {
})
const saveJob = () => {
validateJobFields()
if (jobDetail.data) {
editJobDetails()
} else {
@@ -293,6 +294,14 @@ const editJobDetails = () => {
)
}
const validateJobFields = () => {
Object.keys(job).forEach((key) => {
if (key != 'description' && typeof job[key] === 'string') {
job[key] = escapeHTML(job[key])
}
})
}
const saveImage = (file) => {
job.image = file
}

View File

@@ -142,7 +142,6 @@ const renderEditor = (holder) => {
return new EditorJS({
holder: holder,
tools: getEditorTools(true),
autofocus: true,
defaultBlock: 'markdown',
onChange: async (api, event) => {
enablePlyr()

View File

@@ -254,11 +254,7 @@ const props = defineProps({
const questions = ref([])
onMounted(() => {
if (
props.quizID == 'new' &&
!user.data?.is_moderator &&
!user.data?.is_instructor
) {
if (!user.data?.is_moderator && !user.data?.is_instructor) {
router.push({ name: 'Courses' })
}
if (props.quizID !== 'new') {

File diff suppressed because it is too large Load Diff

View File

@@ -4,16 +4,17 @@
import frappe
from frappe.model.document import Document
from lms.lms.api import update_course_statistics
from lms.lms.utils import get_course_progress
from lms.lms.utils import get_course_progress, get_lesson_count
class CourseChapter(Document):
def on_update(self):
self.recalculate_course_progress()
update_course_statistics()
self.update_lesson_count()
frappe.enqueue(method=self.recalculate_course_progress, queue="short", timeout=300, is_async=True)
def recalculate_course_progress(self):
"""Recalculate course progress if a new lesson is added or removed"""
previous_lessons = self.get_doc_before_save() and self.get_doc_before_save().as_dict().lessons
current_lessons = self.lessons
@@ -22,3 +23,7 @@ class CourseChapter(Document):
for enrollment in enrolled_members:
new_progress = get_course_progress(self.course, enrollment.member)
frappe.db.set_value("LMS Enrollment", enrollment.name, "progress", new_progress)
def update_lesson_count(self):
"""Update lesson count in the course"""
frappe.db.set_value("LMS Course", self.course, "lessons", get_lesson_count(self.course))

1374
yarn.lock

File diff suppressed because it is too large Load Diff