fix: delete batch and pass fields prop to brand settings

This commit is contained in:
Jannat Patel
2025-07-10 22:21:26 +05:30
parent b8ae0db0bd
commit 6f9f27c030
6 changed files with 152 additions and 27 deletions

View File

@@ -990,7 +990,30 @@ def delete_course(course):
frappe.delete_doc("LMS Course", course)
def give_dicussions_permission():
@frappe.whitelist()
def delete_batch(batch):
frappe.db.delete("LMS Batch Enrollment", {"batch": batch})
frappe.db.delete("Batch Course", {"parent": batch, "parenttype": "LMS Batch"})
frappe.db.delete("LMS Assessment", {"parent": batch, "parenttype": "LMS Batch"})
frappe.db.delete("LMS Batch Timetable", {"parent": batch, "parenttype": "LMS Batch"})
frappe.db.delete("LMS Batch Feedback", {"batch": batch})
delete_batch_discussions(batch)
frappe.db.delete("LMS Batch", batch)
def delete_batch_discussions(batch):
topics = frappe.get_all(
"Discussion Topic",
{"reference_doctype": "LMS Batch", "reference_docname": batch},
pluck="name",
)
for topic in topics:
frappe.db.delete("Discussion Reply", {"topic": topic})
frappe.db.delete("Discussion Topic", topic)
def give_discussions_permission():
doctypes = ["Discussion Topic", "Discussion Reply"]
roles = ["LMS Student", "Course Creator", "Moderator", "Batch Evaluator"]
for doctype in doctypes: