Merge pull request #1311 from pateljannat/issues-77
fix: students should have access private batch if enrolled
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div v-if="batch.data" class="border-2 rounded-md p-5 lg:w-72">
|
||||
<div
|
||||
v-if="batch.data.seat_count && seats_left > 0"
|
||||
class="text-xs bg-green-200 text-green-800 float-right px-2 py-0.5 rounded-md"
|
||||
class="text-xs bg-green-100 text-green-700 float-right px-2 py-0.5 rounded-md"
|
||||
>
|
||||
{{ seats_left }}
|
||||
<span v-if="seats_left > 1">
|
||||
@@ -14,7 +14,7 @@
|
||||
</div>
|
||||
<div
|
||||
v-else-if="batch.data.seat_count && seats_left <= 0"
|
||||
class="text-xs bg-red-200 text-red-900 float-right px-2 py-0.5 rounded-md"
|
||||
class="text-xs bg-red-100 text-red-700 float-right px-2 py-0.5 rounded-md"
|
||||
>
|
||||
{{ __('Sold Out') }}
|
||||
</div>
|
||||
|
||||
@@ -1194,7 +1194,14 @@ def get_neighbour_lesson(course, chapter, lesson):
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def get_batch_details(batch):
|
||||
if not frappe.db.get_value("LMS Batch", batch, "published") and has_student_role():
|
||||
batch_students = frappe.get_all(
|
||||
"LMS Batch Enrollment", {"batch": batch}, pluck="member"
|
||||
)
|
||||
if (
|
||||
not frappe.db.get_value("LMS Batch", batch, "published")
|
||||
and has_student_role()
|
||||
and frappe.session.user not in batch_students
|
||||
):
|
||||
return
|
||||
|
||||
batch_details = frappe.db.get_value(
|
||||
@@ -1229,9 +1236,7 @@ def get_batch_details(batch):
|
||||
batch_details.courses = frappe.get_all(
|
||||
"Batch Course", filters={"parent": batch}, fields=["course", "title", "evaluator"]
|
||||
)
|
||||
batch_details.students = frappe.get_all(
|
||||
"LMS Batch Enrollment", {"batch": batch}, pluck="member"
|
||||
)
|
||||
batch_details.students = batch_students
|
||||
|
||||
if batch_details.paid_batch and batch_details.start_date >= getdate():
|
||||
batch_details.amount, batch_details.currency = check_multicurrency(
|
||||
|
||||
Reference in New Issue
Block a user