fix: misc issues

This commit is contained in:
Jannat Patel
2025-12-02 15:41:42 +05:30
parent 1c0be8a2ec
commit 7bc6dff6ea
6 changed files with 103 additions and 7885 deletions

View File

@@ -352,7 +352,7 @@
"options": "Email Template"
},
{
"default": "0",
"default": "1",
"fieldname": "disable_signup",
"fieldtype": "Check",
"label": "Disable Signup"
@@ -444,7 +444,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2025-10-07 19:22:48.705933",
"modified": "2025-12-02 12:21:15.832799",
"modified_by": "sayali@frappe.io",
"module": "LMS",
"name": "LMS Settings",

View File

@@ -504,6 +504,17 @@ def can_create_courses(course, member=None):
return False
def can_create_batches(member=None):
if not member:
member = frappe.session.user
if has_course_moderator_role(member):
return True
if has_course_evaluator_role(member):
return True
return False
def has_course_moderator_role(member=None):
return frappe.db.get_value(
"Has Role",
@@ -1335,12 +1346,12 @@ def get_neighbour_lesson(course, chapter, lesson):
@frappe.whitelist(allow_guest=True)
@rate_limit(limit=50, seconds=60 * 60)
@rate_limit(limit=500, seconds=60 * 60)
def get_batch_details(batch):
batch_students = frappe.get_all("LMS Batch Enrollment", {"batch": batch}, pluck="member")
if (
not frappe.db.get_value("LMS Batch", batch, "published")
and has_student_role()
and not can_create_batches()
and frappe.session.user not in batch_students
):
return