diff --git a/lms/lms/doctype/lms_course/lms_course.json b/lms/lms/doctype/lms_course/lms_course.json index f4b03ffa..4ded3fe5 100644 --- a/lms/lms/doctype/lms_course/lms_course.json +++ b/lms/lms/doctype/lms_course/lms_course.json @@ -1,12 +1,5 @@ { - "actions": [ - { - "action": "lms.lms.doctype.lms_course.lms_course.reindex_exercises", - "action_type": "Server Action", - "group": "Reindex", - "label": "Reindex Exercises" - } - ], + "actions": [], "allow_import": 1, "allow_rename": 1, "creation": "2022-02-22 15:28:26.091549", @@ -313,7 +306,7 @@ } ], "make_attachments_public": 1, - "modified": "2025-12-11 17:21:05.231761", + "modified": "2025-12-15 15:15:42.226098", "modified_by": "sayali@frappe.io", "module": "LMS", "name": "LMS Course", diff --git a/lms/lms/doctype/lms_course/lms_course.py b/lms/lms/doctype/lms_course/lms_course.py index 5f8acb55..f62eb135 100644 --- a/lms/lms/doctype/lms_course/lms_course.py +++ b/lms/lms/doctype/lms_course/lms_course.py @@ -9,8 +9,6 @@ from frappe import _ from frappe.model.document import Document from frappe.utils import cint, today -from lms.lms.utils import get_chapters - from ...utils import generate_slug, update_payment_record, validate_image @@ -133,58 +131,3 @@ class LMSCourse(Document): def __repr__(self): return f"" - - def has_mentor(self, email): - """Checks if this course has a mentor with given email.""" - if not email or email == "Guest": - return False - - mapping = frappe.get_all("LMS Course Mentor Mapping", {"course": self.name, "mentor": email}) - return mapping != [] - - def add_mentor(self, email): - """Adds a new mentor to the course.""" - if not email: - raise ValueError("Invalid email") - if email == "Guest": - raise ValueError("Guest user can not be added as a mentor") - - # given user is already a mentor - if self.has_mentor(email): - return - - doc = frappe.get_doc({"doctype": "LMS Course Mentor Mapping", "course": self.name, "mentor": email}) - doc.insert() - - def get_cohorts(self): - return frappe.get_all( - "Cohort", - {"course": self.name}, - ["name", "slug", "title", "begin_date", "end_date"], - order_by="creation", - ) - - def get_cohort(self, cohort_slug): - name = frappe.get_value("Cohort", {"course": self.name, "slug": cohort_slug}) - return name and frappe.get_doc("Cohort", name) - - def reindex_exercises(self): - for i, c in enumerate(get_chapters(self.name), start=1): - self._reindex_exercises_in_chapter(c, i) - - def _reindex_exercises_in_chapter(self, c, index): - i = 1 - for lesson in self.get_lessons(c): - for exercise in lesson.get_exercises(): - exercise.index_ = i - exercise.index_label = f"{index}.{i}" - exercise.save() - i += 1 - - -@frappe.whitelist() -def reindex_exercises(doc): - course_data = json.loads(doc) - course = frappe.get_doc("LMS Course", course_data["name"]) - course.reindex_exercises() - frappe.msgprint("All exercises in this course have been re-indexed.") diff --git a/lms/lms/doctype/lms_enrollment/lms_enrollment.json b/lms/lms/doctype/lms_enrollment/lms_enrollment.json index a3863f33..348e2437 100644 --- a/lms/lms/doctype/lms_enrollment/lms_enrollment.json +++ b/lms/lms/doctype/lms_enrollment/lms_enrollment.json @@ -19,8 +19,6 @@ "purchased_certificate", "certificate", "section_break_8", - "cohort", - "subgroup", "column_break_12", "member_type", "role" @@ -94,18 +92,6 @@ "label": "Progress", "read_only": 1 }, - { - "fieldname": "cohort", - "fieldtype": "Link", - "label": "Cohort", - "options": "Cohort" - }, - { - "fieldname": "subgroup", - "fieldtype": "Link", - "label": "Subgroup", - "options": "Cohort Subgroup" - }, { "fieldname": "column_break_12", "fieldtype": "Column Break" @@ -148,7 +134,7 @@ "grid_page_length": 50, "index_web_pages_for_search": 1, "links": [], - "modified": "2025-12-09 21:27:30.733482", + "modified": "2025-12-15 21:27:30.733483", "modified_by": "Administrator", "module": "LMS", "name": "LMS Enrollment", diff --git a/lms/lms/doctype/lms_enrollment/lms_enrollment.py b/lms/lms/doctype/lms_enrollment/lms_enrollment.py index e896edcc..f55c9ef0 100644 --- a/lms/lms/doctype/lms_enrollment/lms_enrollment.py +++ b/lms/lms/doctype/lms_enrollment/lms_enrollment.py @@ -37,8 +37,8 @@ class LMSEnrollment(Document): "LMS Payment", { "reference_doctype": "LMS Course", - "reference_docname": course, - "member": member, + "reference_docname": self.course, + "member": self.member, "payment_receipt": True, }, ) diff --git a/pyproject.toml b/pyproject.toml index e0ffb3de..66a0897b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ dependencies = [ # core dependencies "websocket_client~=1.6.4", "markdown~=3.5.1", - "beautifulsoup4~=4.13.4", + "beautifulsoup4>=4.12,<4.14", "lxml~=4.9.3", "cairocffi==1.5.1", "razorpay~=1.4.1",