diff --git a/lms/lms/doctype/lms_batch/lms_batch.py b/lms/lms/doctype/lms_batch/lms_batch.py index 07752df8..1f7e8306 100644 --- a/lms/lms/doctype/lms_batch/lms_batch.py +++ b/lms/lms/doctype/lms_batch/lms_batch.py @@ -146,7 +146,10 @@ def create_live_class( auto_recording, description=None, ): - frappe.only_for("Moderator") + instructors = frappe.get_all( + "Course Instructor", {"parenttype": "LMS Batch", "parent": batch_name}, pluck="instructor" + ) + payload = { "topic": title, "start_time": format_datetime(f"{date} {time}", "yyyy-MM-ddTHH:mm:ssZ"), @@ -155,6 +158,9 @@ def create_live_class( "private_meeting": True, "auto_recording": "none" if auto_recording == "No Recording" else auto_recording.lower(), "timezone": timezone, + "settings": { + "alternative_hosts": ";".join(instructors) if instructors else "", + }, } headers = { "Authorization": "Bearer " + authenticate(zoom_account), diff --git a/lms/lms/doctype/lms_live_class/lms_live_class.py b/lms/lms/doctype/lms_live_class/lms_live_class.py index 5a54c56a..f54372fc 100644 --- a/lms/lms/doctype/lms_live_class/lms_live_class.py +++ b/lms/lms/doctype/lms_live_class/lms_live_class.py @@ -29,6 +29,7 @@ class LMSLiveClass(Document): { "doctype": "Event", "subject": f"Live Class on {self.title}", + "event_type": "Public", "starts_on": start, "ends_on": get_datetime(start) + timedelta(minutes=cint(self.duration)), } @@ -38,7 +39,9 @@ class LMSLiveClass(Document): def add_event_participants(self, event, calendar): participants = frappe.get_all("LMS Batch Enrollment", {"batch": self.batch_name}, pluck="member") - instructors = frappe.get_all("Course Instructor", {"parent": self.batch_name}, pluck="instructor") + instructors = frappe.get_all( + "Course Instructor", {"parenttype": "LMS Batch", "parent": self.batch_name}, pluck="instructor" + ) participants.append(frappe.session.user) participants.extend(instructors)