From b58d04c7dcefc05fe37d74f8c01075e47445a8ee Mon Sep 17 00:00:00 2001 From: raizasafeel <89463672+raizasafeel@users.noreply.github.com> Date: Wed, 14 Jan 2026 13:56:07 +0530 Subject: [PATCH 1/3] feat(batch): add load more pagination for batch students --- frontend/src/components/BatchStudents.vue | 73 ++++++++++++++--------- lms/lms/utils.py | 19 +++++- 2 files changed, 60 insertions(+), 32 deletions(-) diff --git a/frontend/src/components/BatchStudents.vue b/frontend/src/components/BatchStudents.vue index d6e336a8..26665db5 100644 --- a/frontend/src/components/BatchStudents.vue +++ b/frontend/src/components/BatchStudents.vue @@ -2,7 +2,7 @@
- {{ students.data?.length }} {{ __('Students') }} + {{ studentCount.data ?? 0 }} {{ __('Students') }}
-
-
@@ -146,10 +146,11 @@ const props = defineProps({ }) const studentCount = createResource({ - url: 'lms.lms.utils.get_batch_student_count', + url: 'frappe.client.get_count', cache: ['batch_student_count', props.batch?.data?.name], params: { - batch: props.batch?.data?.name, + doctype: 'LMS Batch Enrollment', + filters: { batch: props.batch?.data?.name }, }, auto: true, }) diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 0acb2565..9cd9a516 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -1355,6 +1355,13 @@ def get_exercise_details(assessment, member): assessment.edit_url = f"/exercises/{assessment.assessment_name}/submission/new" +@frappe.whitelist() +def get_batch_assessment_count(batch): + if not frappe.db.exists("LMS Batch", batch): + frappe.throw(_("The specified batch does not exist.")) + return frappe.db.count("LMS Assessment", {"parent": batch}) + + @frappe.whitelist() def get_batch_students(filters, offset=0, limit_start=0, limit_page_length=None, limit=None): # limit_start and limit_page_length are used for backward compatibility @@ -1383,27 +1390,6 @@ def get_batch_students(filters, offset=0, limit_start=0, limit_page_length=None, return students -@frappe.whitelist() -def get_batch_student_count(batch): - if not frappe.db.exists("LMS Batch", batch): - frappe.throw(_("The specified batch does not exist.")) - return frappe.db.count("LMS Batch Enrollment", filters={"batch": batch}) - - -@frappe.whitelist() -def get_batch_certificate_count(batch): - if not frappe.db.exists("LMS Batch", batch): - frappe.throw(_("The specified batch does not exist.")) - return frappe.db.count("LMS Certificate", filters={"batch_name": batch}) - - -@frappe.whitelist() -def get_batch_assessment_count(batch): - if not frappe.db.exists("LMS Batch", batch): - frappe.throw(_("The specified batch does not exist.")) - return frappe.db.count("LMS Assessment", filters={"parent": batch}) - - def get_course_completion_stats(batch): """Get completion counts per course in batch""" BatchCourse = frappe.qb.DocType("Batch Course")