feat: instructors in courses and batches

This commit is contained in:
Jannat Patel
2024-06-25 18:43:28 +05:30
parent 8625ac048a
commit 96028c9f42
12 changed files with 449 additions and 75 deletions
+16 -3
View File
@@ -26,10 +26,12 @@
"evaluation_end_date",
"section_break_6",
"description",
"batch_details_raw",
"column_break_hlqw",
"batch_details",
"instructors",
"meta_image",
"section_break_khcn",
"batch_details",
"batch_details_raw",
"section_break_jgji",
"students",
"courses",
@@ -308,11 +310,22 @@
"fieldtype": "Data",
"label": "Timezone",
"reqd": 1
},
{
"fieldname": "instructors",
"fieldtype": "Table MultiSelect",
"label": "Instructors",
"options": "Course Instructor",
"reqd": 1
},
{
"fieldname": "section_break_khcn",
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-06-21 11:49:32.582832",
"modified": "2024-06-24 16:24:45.536453",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch",
+3 -2
View File
@@ -119,7 +119,8 @@
"in_standard_filter": 1,
"label": "Instructors",
"max_height": "50px",
"options": "Course Instructor"
"options": "Course Instructor",
"reqd": 1
},
{
"fieldname": "section_break_7",
@@ -275,7 +276,7 @@
}
],
"make_attachments_public": 1,
"modified": "2024-05-24 18:03:38.330443",
"modified": "2024-06-24 17:44:45.903164",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",
+3 -2
View File
@@ -196,8 +196,7 @@ def get_instructors(course):
instructors = frappe.get_all(
"Course Instructor", {"parent": course}, order_by="idx", pluck="instructor"
)
if not instructors:
instructors = frappe.db.get_value("LMS Course", course, "owner").split(" ")
for instructor in instructors:
instructor_details.append(
frappe.db.get_value(
@@ -1517,6 +1516,8 @@ def get_batch_details(batch):
as_dict=True,
)
batch_details.instructors = get_instructors(batch)
batch_details.courses = frappe.get_all(
"Batch Course", filters={"parent": batch}, fields=["course", "title"]
)