diff --git a/frappe-ui b/frappe-ui index 3b700c7a..c5faaae3 160000 --- a/frappe-ui +++ b/frappe-ui @@ -1 +1 @@ -Subproject commit 3b700c7a8a77277e62cdc770ccad6fd79b07a2a5 +Subproject commit c5faaae38ec6314879aa0abf3a3f992cb6f2240b diff --git a/frontend/src/components/CourseCard.vue b/frontend/src/components/CourseCard.vue index c30e37ff..6fb0e35e 100644 --- a/frontend/src/components/CourseCard.vue +++ b/frontend/src/components/CourseCard.vue @@ -21,32 +21,29 @@
- - - {{ course.lesson_count }} + + + + {{ course.lesson_count }} +
- - - {{ course.enrollment_count }} + + + + {{ course.enrollment_count }} +
- - - {{ course.avg_rating }} + + + + {{ course.avg_rating }} +
diff --git a/frontend/src/components/CourseOutline.vue b/frontend/src/components/CourseOutline.vue index 070f6909..3cf37fff 100644 --- a/frontend/src/components/CourseOutline.vue +++ b/frontend/src/components/CourseOutline.vue @@ -65,6 +65,10 @@ class="h-4 w-4 text-gray-900 stroke-1 mr-2" /> {{ lesson.title }} +
@@ -108,6 +112,7 @@ import { MonitorPlay, HelpCircle, FileText, + Check, } from 'lucide-vue-next' import { useRoute } from 'vue-router' import ChapterModal from '@/components/Modals/ChapterModal.vue' diff --git a/frontend/src/pages/Lesson.vue b/frontend/src/pages/Lesson.vue index 1d59b2c4..55e4a02c 100644 --- a/frontend/src/pages/Lesson.vue +++ b/frontend/src/pages/Lesson.vue @@ -230,6 +230,8 @@ const lesson = createResource({ name: data.membership.name, lesson_name: data.name, }) + markProgress(data) + if (data.content) editor = renderEditor('editor', data.content) if (data.instructor_content) @@ -237,8 +239,6 @@ const lesson = createResource({ 'instructor-content', data.instructor_content ) - - markProgress(data) }, }) @@ -253,9 +253,7 @@ const renderEditor = (holder, content) => { } const markProgress = (data) => { - setTimeout(() => { - if (!data.progress) progress.submit() - }, 60000) + if (!data.progress) progress.submit() } const current_lesson = createResource({ diff --git a/lms/lms/doctype/course_lesson/course_lesson.json b/lms/lms/doctype/course_lesson/course_lesson.json index 608227f7..3829ea7e 100644 --- a/lms/lms/doctype/course_lesson/course_lesson.json +++ b/lms/lms/doctype/course_lesson/course_lesson.json @@ -66,7 +66,8 @@ }, { "fieldname": "section_break_6", - "fieldtype": "Section Break" + "fieldtype": "Section Break", + "hidden": 1 }, { "fieldname": "body", @@ -78,6 +79,7 @@ { "fieldname": "help_section", "fieldtype": "Section Break", + "hidden": 1, "label": "Help" }, { @@ -117,6 +119,7 @@ { "fieldname": "section_break_16", "fieldtype": "Section Break", + "hidden": 1, "label": "Assignment" }, { @@ -158,7 +161,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2024-03-14 14:25:22.464111", + "modified": "2024-04-03 10:48:17.525859", "modified_by": "Administrator", "module": "LMS", "name": "Course Lesson", diff --git a/lms/lms/doctype/course_lesson/course_lesson.py b/lms/lms/doctype/course_lesson/course_lesson.py index b3668bad..9b27b19a 100644 --- a/lms/lms/doctype/course_lesson/course_lesson.py +++ b/lms/lms/doctype/course_lesson/course_lesson.py @@ -98,6 +98,11 @@ def save_progress(lesson, course): if not quiz_completed: return 0 + if frappe.db.exists( + "LMS Course Progress", {"lesson": lesson, "member": frappe.session.user} + ): + return 0 + frappe.get_doc( { "doctype": "LMS Course Progress", @@ -116,7 +121,6 @@ def get_quiz_progress(lesson): body = frappe.db.get_value("Course Lesson", lesson, "body") macros = find_macros(body) quizzes = [value for name, value in macros if name == "Quiz"] - for quiz in quizzes: passing_percentage = frappe.db.get_value("LMS Quiz", quiz, "passing_percentage") if not frappe.db.exists( @@ -128,7 +132,6 @@ def get_quiz_progress(lesson): }, ): return False - return True diff --git a/lms/lms/doctype/lms_quiz/lms_quiz.py b/lms/lms/doctype/lms_quiz/lms_quiz.py index ce59b29e..aa852f96 100644 --- a/lms/lms/doctype/lms_quiz/lms_quiz.py +++ b/lms/lms/doctype/lms_quiz/lms_quiz.py @@ -6,7 +6,7 @@ import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import cstr, comma_and -from lms.lms.doctype.lms_question.lms_question import validate_correct_answers +from lms.lms.doctype.course_lesson.course_lesson import save_progress from lms.lms.utils import ( generate_slug, has_course_moderator_role, @@ -86,7 +86,7 @@ def quiz_summary(quiz, results): del result["question_index"] quiz_details = frappe.db.get_value( - "LMS Quiz", quiz, ["total_marks", "passing_percentage"], as_dict=1 + "LMS Quiz", quiz, ["total_marks", "passing_percentage", "lesson", "course"], as_dict=1 ) score_out_of = quiz_details.total_marks percentage = (score / score_out_of) * 100 @@ -103,6 +103,16 @@ def quiz_summary(quiz, results): "passing_percentage": quiz_details.passing_percentage, } ) + print( + percentage, quiz_details.passing_percentage, quiz_details.lesson, quiz_details.course + ) + if ( + percentage >= quiz_details.passing_percentage + and quiz_details.lesson + and quiz_details.course + ): + save_progress(quiz_details.lesson, quiz_details.course) + submission.save(ignore_permissions=True) return { diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 0c309e28..9c59eb98 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -155,11 +155,13 @@ def get_lesson_details(chapter): "question", "file_type", "instructor_notes", + "course", ], as_dict=True, ) lesson_details.number = f"{chapter.idx}.{row.idx}" lesson_details.icon = get_lesson_icon(lesson_details.body) + lesson_details.is_complete = get_progress(lesson_details.course, lesson_details.name) lessons.append(lesson_details) return lessons @@ -307,7 +309,7 @@ def get_progress(course, lesson, member=None): return frappe.db.get_value( "LMS Course Progress", - {"course": course, "owner": member, "lesson": lesson}, + {"course": course, "member": member, "lesson": lesson}, ["status"], ) diff --git a/lms/public/frontend/index.html b/lms/public/frontend/index.html index 6d1e1976..3f23d01a 100644 --- a/lms/public/frontend/index.html +++ b/lms/public/frontend/index.html @@ -15,14 +15,29 @@ - - + + - +
-

{{ meta.title }}

+

{{ meta.title }}

+

+ {{ meta.description }} +

+

+ The content here is just for seo purposes. The actual content will be loaded in a few seconds. +

+

+ Seo checks if a page has more than 300 words. So, here are some more words to make it more than 300 words. + Page descriptions are the HTML meta tags that provide a brief summary of a web page. + Search engines use meta descriptions to help identify the page's topic - they don't use them to rank the page, but they do use them to determine whether or not to display the page in search results. + Meta descriptions are important because they're often the first thing people see when they're deciding which search result to click on. + They're also important because they can help improve your click-through rate (CTR) from search results. + A good meta description can entice people to click on your page instead of someone else's. +

+ Know More