diff --git a/lms/lms/doctype/batch_student/batch_student.py b/lms/lms/doctype/batch_student/batch_student.py index d3168f71..733b989e 100644 --- a/lms/lms/doctype/batch_student/batch_student.py +++ b/lms/lms/doctype/batch_student/batch_student.py @@ -11,6 +11,10 @@ class BatchStudent(Document): @frappe.whitelist() def enroll_batch(batch_name): + if frappe.db.exists( + "Batch Student", {"student": frappe.session.user, "parent": batch_name} + ): + frappe.throw("You are already enrolled in this batch") enrollment = frappe.new_doc("Batch Student") enrollment.student = frappe.session.user enrollment.parent = batch_name diff --git a/lms/www/batches/batch_details.html b/lms/www/batches/batch_details.html index ddfbba43..bf24e971 100644 --- a/lms/www/batches/batch_details.html +++ b/lms/www/batches/batch_details.html @@ -150,7 +150,7 @@ href="/billing/batch/{{ batch_info.name }}"> {{ _("Register Now") }} - {% elif batch_info.allow_self_enrollment %} + {% elif batch_info.allow_self_enrollment and batch_info.seat_count and seats_left %} diff --git a/lms/www/billing/billing.html b/lms/www/billing/billing.html index b97ca3b3..ae344328 100644 --- a/lms/www/billing/billing.html +++ b/lms/www/billing/billing.html @@ -38,7 +38,7 @@
{{ frappe.db.count("Cohort Subgroup", {"cohort": cohort.name}) }} {{ diff --git a/lms/www/courses/index.html b/lms/www/courses/index.html index 52ea23f7..f073a4b8 100644 --- a/lms/www/courses/index.html +++ b/lms/www/courses/index.html @@ -169,3 +169,8 @@ {% endblock %} +{% block script %} + +{% endblock %}