refactor(batch): simplify dashboard with get_count and conditional rendering

This commit is contained in:
raizasafeel
2026-01-14 23:25:11 +05:30
parent c59be28a26
commit e2c0355821
3 changed files with 18 additions and 26 deletions

View File

@@ -82,18 +82,23 @@ const studentCount = createResource({
const assessmentCount = createResource({
url: 'lms.lms.utils.get_batch_assessment_count',
params: { batch: props.batch?.data?.name },
cache: ['batch_assessment_count', props.batch?.data?.name],
params: {
batch: props.batch?.data?.name,
},
auto: true,
})
const chartData = createResource({
url: 'lms.lms.utils.get_batch_chart_data',
cache: ['batch_chart_data', props.batch?.data?.name],
params: { batch: props.batch?.data?.name },
auto: true,
})
const certificationCount = createResource({
url: 'frappe.client.get_count',
cache: ['batch_certificate_count', props.batch?.data?.name],
params: {
doctype: 'LMS Certificate',
filters: { batch_name: props.batch?.data?.name },

View File

@@ -88,8 +88,8 @@
</div>
</template>
</ListSelectBanner>
<div class="mt-4">
<Button v-if="students.hasNextPage" @click="students.next()">
<div class="mt-4" v-if="students.hasNextPage">
<Button @click="students.next()">
{{ __('Load More') }}
</Button>
</div>
@@ -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,
})