From e3aa828f9fb6f07a7dd6efad2bbc4e4df33caab5 Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Tue, 19 Nov 2024 16:21:31 +0530 Subject: [PATCH] fix left short rebate bug --- home/admin.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/home/admin.py b/home/admin.py index 39c7f1b..695b2bf 100644 --- a/home/admin.py +++ b/home/admin.py @@ -790,7 +790,7 @@ def export_as_csv(self, request, queryset): """ Export action available in the admin page """ - resource = RebateBillsResource() + resource = StudentBillsResource() dataset = resource.export(queryset) response = HttpResponse(dataset.csv, content_type="text/csv") response["Content-Disposition"] = 'attachment; filename="RebateAutumn.csv"' @@ -1050,9 +1050,10 @@ def Add(self, request, queryset: list[LeftShortRebate]): upper_cap_check = max_days_rebate( student_obj, start_date, end_date, period ) - if upper_cap_check == 0: - continue - end_date = start_date + timedelta(days=upper_cap_check - 1) + if upper_cap_check > 0: + end_date = start_date + timedelta( + days=(upper_cap_check - 1) + ) short_rebate = Rebate( email=student_obj, allocation_id=allocation,