From c266fd69fdb5bd6531dc5560d079158925cb922f Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Tue, 1 Oct 2024 16:10:56 +0530 Subject: [PATCH] quick fix --- home/utils/rebate_bills_saver.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/home/utils/rebate_bills_saver.py b/home/utils/rebate_bills_saver.py index c3621d2..ad1affb 100644 --- a/home/utils/rebate_bills_saver.py +++ b/home/utils/rebate_bills_saver.py @@ -1,3 +1,5 @@ +from datetime import timedelta + from home.models.students import LongRebate, Rebate from ..models import ( @@ -190,13 +192,13 @@ def fix_all_bills( rebate.end_date - rebate.start_date ).days + 1 continue - rebate.start_date = period_1.end_date + 1 + rebate.start_date = period_1.end_date + timedelta(days=1) if rebate.end_date <= period_2.end_date: short_rebates_per_period[1] += ( rebate.end_date - rebate.start_date ).days + 1 continue - rebate.start_date = period_2.end_date + 1 + rebate.start_date = period_2.end_date + timedelta(days=1) if rebate.end_date <= period_3.end_date: short_rebates_per_period[2] += ( rebate.end_date - rebate.start_date @@ -215,11 +217,11 @@ def fix_all_bills( if rebate.end_date <= period_1.end_date: long_rebates_per_period[0] += (rebate.end_date - rebate.start_date).days + 1 continue - rebate.start_date = period_1.end_date + 1 + rebate.start_date = period_1.end_date + timedelta(days=1) if rebate.end_date <= period_2.end_date: long_rebates_per_period[1] += (rebate.end_date - rebate.start_date).days + 1 continue - rebate.start_date = period_2.end_date + 1 + rebate.start_date = period_2.end_date + timedelta(days=1) if rebate.end_date <= period_3.end_date: long_rebates_per_period[2] += (rebate.end_date - rebate.start_date).days + 1 continue