From fa721584d6e527bc51269b22b4fec5f88bb4711a Mon Sep 17 00:00:00 2001 From: Ishaan Mittal Date: Tue, 1 Oct 2024 16:40:57 +0530 Subject: [PATCH] add limits (#85) --- home/utils/rebate_bills_saver.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/home/utils/rebate_bills_saver.py b/home/utils/rebate_bills_saver.py index ebaa6b9..4454f5b 100644 --- a/home/utils/rebate_bills_saver.py +++ b/home/utils/rebate_bills_saver.py @@ -240,6 +240,13 @@ def fix_all_bills( long_rebates_per_period[2] += (rebate.end_date - rebate.start_date).days + 1 continue long_rebates_per_period[2] += (period_3.end_date - rebate.start_date).days + 1 + for i in range(3): + if short_rebates_per_period[i] > 8: + short_rebates_per_period[i] = 8 + if short_rebates_per_period[i] < 0: + short_rebates_per_period[i] = 0 + if long_rebates_per_period[i] < 0: + long_rebates_per_period[i] = 0 print(short_rebates_per_period, long_rebates_per_period) student_bill.period1_short = short_rebates_per_period[0] student_bill.period2_short = short_rebates_per_period[1]