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):
{{ message.author_name }}
-
+ {{ message.message_time }} -
+
{{ message.message }} diff --git a/community/lms/widgets/BatchTabs.html b/community/lms/widgets/BatchTabs.html index cf3c8518..48378660 100644 --- a/community/lms/widgets/BatchTabs.html +++ b/community/lms/widgets/BatchTabs.html @@ -1,4 +1,4 @@ -
+
Courses /{% if course.is_mentor(frappe.session.user) %} {{ course.title }} {% else %} {{ course.title }} {% endif %}

Batch Details

{{ frappe.utils.md_to_html(batch.description) }} - {{ ConnectWithBatch(batch) }}
@@ -45,13 +44,3 @@ {% endmacro %} - -{% macro ConnectWithBatch(batch)%} -

Connect with your Batch

-

- 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 @@
- Courses / {{ course.title }} + Courses / {{ course.title }}

{{course.title}}

{{ course.short_introduction }}
@@ -18,7 +18,7 @@
-
+
{{ CourseVideo(course) }} {{ CourseDescription(course) }} @@ -39,58 +39,54 @@ {% endblock %} {% macro CourseVideo(course) %} - {% if course.video_link %} -
- -
- {% endif %} +{% if course.video_link %} +
+ +
+{% endif %} {% endmacro %} {% macro CourseDescription(course) %} -

Course Description

+

Course Description

-
- {{ frappe.utils.md_to_html(course.description) }} -
+
+ {{ frappe.utils.md_to_html(course.description) }} +
{% endmacro %} {% macro BatchSection(course) %} - {% if course.is_mentor(frappe.session.user) %} - {{ BatchSectionForMentors(course, course.get_batches(mentor=frappe.session.user)) }} - {% else %} - {{ BatchSectionForStudents(course, course.get_upcoming_batches()) }} - {% endif %} +{% if course.is_mentor(frappe.session.user) %} +{{ BatchSectionForMentors(course, course.get_batches(mentor=frappe.session.user)) }} +{% else %} +{{ BatchSectionForStudents(course, course.get_upcoming_batches()) }} +{% endif %} {% endmacro %} {% macro RenderBatch(batch, can_manage=False) %}
-
Session every {{batch.sessions_on}}
-
{{frappe.utils.format_time(batch.start_time, "short")}} - - {{frappe.utils.format_time(batch.end_time, "short")}}
-
Starting {{frappe.utils.format_date(batch.start_date, "medium")}}
-
mentors
+
Session every {{batch.sessions_on}}
+
{{frappe.utils.format_time(batch.start_time, "short")}} - + {{frappe.utils.format_time(batch.end_time, "short")}} +
+
Starting {{frappe.utils.format_date(batch.start_date, "medium")}}
+
mentors
- {% for m in batch.get_mentors() %} + {% for m in batch.get_mentors() %}
{{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }} {{m.full_name}}
- {% endfor %} + {% endfor %}
{% if can_manage %} - Manage + Manage {% else %} - {% endif %}
@@ -99,38 +95,41 @@ {% endmacro %} {% macro BatchSectionForMentors(course, mentor_batches) %} -

Your Batches

+

Your Batches

- {% if mentor_batches %} -
+{% if mentor_batches %} + -
- {% for batch in mentor_batches %} -
- {{ RenderBatch(batch, can_manage=True) }} -
- {% endfor %} -
+
+ {% for batch in mentor_batches %} +
+ {{ RenderBatch(batch, can_manage=True) }} +
+ {% endfor %} +
- Add a new batch - {% else %} -
-

You are a mentor for this course.

- Create your first batch -
- {% endif %} +Add a new + batch +{% else %} +
+

You are a mentor for this course.

+ Create your first batch +
+{% endif %} {% endmacro %} {% macro BatchSectionForStudents(course, upcoming_batches) %} -

Upcoming Batches

+{% if upcoming_batches %} +

Upcoming Batches

-
- {% for batch in upcoming_batches %} -
- {{ RenderBatch(batch, can_manage=False) }} -
- {% endfor %} +
+ {% for batch in upcoming_batches %} +
+ {{ RenderBatch(batch, can_manage=False) }}
+ {% endfor %} +
+{% endfor %} {% endmacro %} diff --git a/community/www/courses/index.html b/community/www/courses/index.html index 76c649f8..6a69235c 100644 --- a/community/www/courses/index.html +++ b/community/www/courses/index.html @@ -31,12 +31,14 @@ {% macro course_card(course) %}