diff --git a/community/lms/doctype/lms_batch/lms_batch.json b/community/lms/doctype/lms_batch/lms_batch.json index 9055db0d..1783be8f 100644 --- a/community/lms/doctype/lms_batch/lms_batch.json +++ b/community/lms/doctype/lms_batch/lms_batch.json @@ -6,15 +6,10 @@ "engine": "InnoDB", "field_order": [ "course", - "telegram_link", - "code", - "column_break_3", - "title", - "video_call_link", - "batch_schedule_section", "start_date", "start_time", - "column_break_10", + "column_break_3", + "title", "sessions_on", "end_time", "section_break_5", @@ -35,13 +30,6 @@ "label": "Course", "options": "LMS Course" }, - { - "fieldname": "code", - "fieldtype": "Data", - "label": "Code", - "read_only": 1, - "unique": 1 - }, { "fieldname": "title", "fieldtype": "Data", @@ -122,25 +110,6 @@ "fieldtype": "Time", "in_list_view": 1, "label": "End Time" - }, - { - "fieldname": "telegram_link", - "fieldtype": "Data", - "label": "Telegram Link" - }, - { - "fieldname": "video_call_link", - "fieldtype": "Data", - "label": "Video Call Link" - }, - { - "fieldname": "batch_schedule_section", - "fieldtype": "Section Break", - "label": "Batch Schedule" - }, - { - "fieldname": "column_break_10", - "fieldtype": "Column Break" } ], "index_web_pages_for_search": 1, @@ -151,7 +120,7 @@ "link_fieldname": "batch" } ], - "modified": "2021-05-25 18:28:01.718521", + "modified": "2021-05-26 16:43:57.399747", "modified_by": "Administrator", "module": "LMS", "name": "LMS Batch", diff --git a/community/lms/doctype/lms_batch/lms_batch.py b/community/lms/doctype/lms_batch/lms_batch.py index 5c12d0f5..185134ae 100644 --- a/community/lms/doctype/lms_batch/lms_batch.py +++ b/community/lms/doctype/lms_batch/lms_batch.py @@ -12,22 +12,15 @@ from community.query import find, find_all class LMSBatch(Document): def validate(self): self.validate_if_mentor() - if not self.code: - self.generate_code() def validate_if_mentor(self): course = frappe.get_doc("LMS Course", self.course) - if not course.is_mentor(frappe.session.user) and self.is_new(): + if not course.is_mentor(frappe.session.user): frappe.throw(_("You are not a mentor of the course {0}").format(course.title)) def after_insert(self): create_membership(batch=self.name, member_type="Mentor") - def generate_code(self): - short_code = frappe.db.get_value("LMS Course", self.course, "short_code") - course_batches = frappe.get_all("LMS Batch",{"course":self.course}) - self.code = short_code + str(len(course_batches) + 1) - def get_mentors(self): memberships = frappe.get_all( "LMS Batch Membership", diff --git a/community/lms/doctype/lms_batch_membership/lms_batch_membership.py b/community/lms/doctype/lms_batch_membership/lms_batch_membership.py index f50b7501..7d714d46 100644 --- a/community/lms/doctype/lms_batch_membership/lms_batch_membership.py +++ b/community/lms/doctype/lms_batch_membership/lms_batch_membership.py @@ -39,7 +39,7 @@ class LMSBatchMembership(Document): for membership in previous_membership: batch_course = frappe.db.get_value("LMS Batch", membership.batch, "course") - if self.name != membership.name and batch_course == course and (membership.member_type == "Student" or self.member_type == "Student"): + if batch_course == course and (membership.member_type == "Student" or self.member_type == "Student"): member_name = frappe.db.get_value("User", self.member, "full_name") frappe.throw(_("{0} is already a {1} of {2} course through {3} batch").format(member_name, membership.member_type, course, membership.batch)) diff --git a/community/lms/doctype/lms_message/lms_message.py b/community/lms/doctype/lms_message/lms_message.py index dac39033..1aa6e71a 100644 --- a/community/lms/doctype/lms_message/lms_message.py +++ b/community/lms/doctype/lms_message/lms_message.py @@ -46,9 +46,9 @@ class LMSMessage(Document):
- Reach out on Telegram. -
-- Join the Online Class. -
-{% endmacro %} diff --git a/community/www/courses/course.html b/community/www/courses/course.html index a375787a..8f39fa1a 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -10,7 +10,7 @@