diff --git a/community/lms/doctype/lms_course/lms_course.py b/community/lms/doctype/lms_course/lms_course.py
index 0f3439ec..0583700e 100644
--- a/community/lms/doctype/lms_course/lms_course.py
+++ b/community/lms/doctype/lms_course/lms_course.py
@@ -192,7 +192,7 @@ class LMSCourse(Document):
return
return f"/courses/{self.name}/learn/{lesson_number}"
- def get_membership(self, member, batch):
+ def get_membership(self, member, batch=None):
filters = {
"member": member,
"course": self.name
@@ -205,6 +205,7 @@ class LMSCourse(Document):
all_memberships = frappe.get_all("LMS Batch Membership", {"member": member, "course": self.name}, ["batch"])
for membership in all_memberships:
membership.batch_title = frappe.db.get_value("LMS Batch", membership.batch, "title")
+ print(all_memberships)
return all_memberships
def get_mentors(self, batch):
diff --git a/community/lms/widgets/BatchTabs.html b/community/lms/widgets/BatchTabs.html
index 2a5fc913..1b6d61d9 100644
--- a/community/lms/widgets/BatchTabs.html
+++ b/community/lms/widgets/BatchTabs.html
@@ -28,7 +28,7 @@
Home
- {% set lesson_index = course.get_lesson_index(membership.current_lesson) if membership.current_lesson else '1.1' %}
+ {% set lesson_index = course.get_lesson_index(membership.current_lesson) if membership and membership.current_lesson else '1.1' %}
Lessons
@@ -44,7 +44,7 @@
- {% if membership.batch and course.is_mentor(frappe.session.user) %}
+ {% if membership and membership.batch and course.is_mentor(frappe.session.user) %}
Progress
diff --git a/community/www/batch/learn.html b/community/www/batch/learn.html
index cca415a7..a65dc4e0 100644
--- a/community/www/batch/learn.html
+++ b/community/www/batch/learn.html
@@ -25,8 +25,8 @@
{{ widgets.BatchTabs(course=course, membership=membership) }}
-
{{ lesson.title }}
+ {{ lesson.title }}
{% if membership or lesson.include_in_preview %}
{{ lesson.render_html() }}
@@ -64,27 +64,4 @@
{% for ext in page_extensions %}
{{ ext.render_footer() }}
{% endfor %}
-
{%- endblock %}
diff --git a/community/www/batch/learn.js b/community/www/batch/learn.js
index c8c59be0..e15c5c5c 100644
--- a/community/www/batch/learn.js
+++ b/community/www/batch/learn.js
@@ -1,17 +1,17 @@
frappe.ready(() => {
- /* if ($(".title").attr("data-batch") && !$(".title").hasClass("is_mentor")) {
+ if ($(".title").attr("data-membership") && !$(".title").hasClass("is_mentor")) {
frappe.call({
method: "community.lms.doctype.lesson.lesson.save_progress",
args: {
- lesson: $(".title").attr("data-name"),
- batch: $(".title").attr("data-batch")
+ lesson: $(".title").attr("data-lesson"),
+ course: $(".title").attr("data-course")
}
})
}
- if ($(".title").attr("data-batch")) {
+ if ($(".title").attr("data-membership")) {
frappe.call("community.lms.api.save_current_lesson", {
- "batch_name": $(".title").attr("data-batch"),
- "lesson_name": $(".title").attr("data-name")
+ course_name: $(".title").attr("data-course"),
+ lesson_name: $(".title").attr("data-lesson")
})
- } */
+ }
})
diff --git a/community/www/batch/utils.py b/community/www/batch/utils.py
index 24326964..23060680 100644
--- a/community/www/batch/utils.py
+++ b/community/www/batch/utils.py
@@ -26,8 +26,8 @@ def get_common_context(context):
context.members = course.get_mentors(membership.batch) + course.get_students(membership.batch)
context.member_count = len(context.members)
- context.course.query_parameter = "?batch=" + batch.name if batch else ""
- print(context.membership)
+
+ context.course.query_parameter = "?batch=" + membership.batch if membership and membership.batch else ""
context.livecode_url = get_livecode_url()
def get_livecode_url():