Skip to content

Commit

Permalink
Fix all rebates (#83)
Browse files Browse the repository at this point in the history
* fix all rebates

* quick fix
  • Loading branch information
mittal-ishaan authored Oct 1, 2024
1 parent 72729ba commit ef43071
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions home/utils/rebate_bills_saver.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import timedelta
from home.models.students import LongRebate, Rebate

from ..models import (
Expand Down Expand Up @@ -190,13 +191,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
Expand All @@ -215,11 +216,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
Expand Down

0 comments on commit ef43071

Please sign in to comment.