Skip to content

Commit 2596b85

Browse files
authored
Merge pull request #1913 from rehanrehman389/cleanup-cohort
chore: Remove deprecated doctype and related links
2 parents 38e6320 + 1210a6a commit 2596b85

5 files changed

Lines changed: 6 additions & 84 deletions

File tree

lms/lms/doctype/lms_course/lms_course.json

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
{
2-
"actions": [
3-
{
4-
"action": "lms.lms.doctype.lms_course.lms_course.reindex_exercises",
5-
"action_type": "Server Action",
6-
"group": "Reindex",
7-
"label": "Reindex Exercises"
8-
}
9-
],
2+
"actions": [],
103
"allow_import": 1,
114
"allow_rename": 1,
125
"creation": "2022-02-22 15:28:26.091549",
@@ -313,7 +306,7 @@
313306
}
314307
],
315308
"make_attachments_public": 1,
316-
"modified": "2025-12-11 17:21:05.231761",
309+
"modified": "2025-12-15 15:15:42.226098",
317310
"modified_by": "sayali@frappe.io",
318311
"module": "LMS",
319312
"name": "LMS Course",

lms/lms/doctype/lms_course/lms_course.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from frappe.model.document import Document
1010
from frappe.utils import cint, today
1111

12-
from lms.lms.utils import get_chapters
13-
1412
from ...utils import generate_slug, update_payment_record, validate_image
1513

1614

@@ -133,58 +131,3 @@ def autoname(self):
133131

134132
def __repr__(self):
135133
return f"<Course#{self.name}>"
136-
137-
def has_mentor(self, email):
138-
"""Checks if this course has a mentor with given email."""
139-
if not email or email == "Guest":
140-
return False
141-
142-
mapping = frappe.get_all("LMS Course Mentor Mapping", {"course": self.name, "mentor": email})
143-
return mapping != []
144-
145-
def add_mentor(self, email):
146-
"""Adds a new mentor to the course."""
147-
if not email:
148-
raise ValueError("Invalid email")
149-
if email == "Guest":
150-
raise ValueError("Guest user can not be added as a mentor")
151-
152-
# given user is already a mentor
153-
if self.has_mentor(email):
154-
return
155-
156-
doc = frappe.get_doc({"doctype": "LMS Course Mentor Mapping", "course": self.name, "mentor": email})
157-
doc.insert()
158-
159-
def get_cohorts(self):
160-
return frappe.get_all(
161-
"Cohort",
162-
{"course": self.name},
163-
["name", "slug", "title", "begin_date", "end_date"],
164-
order_by="creation",
165-
)
166-
167-
def get_cohort(self, cohort_slug):
168-
name = frappe.get_value("Cohort", {"course": self.name, "slug": cohort_slug})
169-
return name and frappe.get_doc("Cohort", name)
170-
171-
def reindex_exercises(self):
172-
for i, c in enumerate(get_chapters(self.name), start=1):
173-
self._reindex_exercises_in_chapter(c, i)
174-
175-
def _reindex_exercises_in_chapter(self, c, index):
176-
i = 1
177-
for lesson in self.get_lessons(c):
178-
for exercise in lesson.get_exercises():
179-
exercise.index_ = i
180-
exercise.index_label = f"{index}.{i}"
181-
exercise.save()
182-
i += 1
183-
184-
185-
@frappe.whitelist()
186-
def reindex_exercises(doc):
187-
course_data = json.loads(doc)
188-
course = frappe.get_doc("LMS Course", course_data["name"])
189-
course.reindex_exercises()
190-
frappe.msgprint("All exercises in this course have been re-indexed.")

lms/lms/doctype/lms_enrollment/lms_enrollment.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
"purchased_certificate",
2020
"certificate",
2121
"section_break_8",
22-
"cohort",
23-
"subgroup",
2422
"column_break_12",
2523
"member_type",
2624
"role"
@@ -94,18 +92,6 @@
9492
"label": "Progress",
9593
"read_only": 1
9694
},
97-
{
98-
"fieldname": "cohort",
99-
"fieldtype": "Link",
100-
"label": "Cohort",
101-
"options": "Cohort"
102-
},
103-
{
104-
"fieldname": "subgroup",
105-
"fieldtype": "Link",
106-
"label": "Subgroup",
107-
"options": "Cohort Subgroup"
108-
},
10995
{
11096
"fieldname": "column_break_12",
11197
"fieldtype": "Column Break"
@@ -148,7 +134,7 @@
148134
"grid_page_length": 50,
149135
"index_web_pages_for_search": 1,
150136
"links": [],
151-
"modified": "2025-12-09 21:27:30.733482",
137+
"modified": "2025-12-15 21:27:30.733483",
152138
"modified_by": "Administrator",
153139
"module": "LMS",
154140
"name": "LMS Enrollment",

lms/lms/doctype/lms_enrollment/lms_enrollment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def validate_course_enrollment_eligibility(self):
3737
"LMS Payment",
3838
{
3939
"reference_doctype": "LMS Course",
40-
"reference_docname": course,
41-
"member": member,
40+
"reference_docname": self.course,
41+
"member": self.member,
4242
"payment_receipt": True,
4343
},
4444
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies = [
1111
# core dependencies
1212
"websocket_client~=1.6.4",
1313
"markdown~=3.5.1",
14-
"beautifulsoup4~=4.13.4",
14+
"beautifulsoup4>=4.12,<4.14",
1515
"lxml~=4.9.3",
1616
"cairocffi==1.5.1",
1717
"razorpay~=1.4.1",

0 commit comments

Comments
 (0)