Skip to content

Commit

Permalink
left long rebate bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mittal-ishaan committed Dec 4, 2023
1 parent 0479670 commit 0968c3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion home/utils/rebate_bills_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def save_short_bill(student,period,days,high_tea,caterer):
def save_long_bill(email,days_per_period,j):
student = Student.objects.filter(email=email).last()
for period,days in days_per_period:
if not isinstance(period, QuerySet):
if isinstance(period, Period):
rebate = StudentBills.objects.get(email=student,semester=period.semester)
allocation = Allocation.objects.get(email=student,period=period)
catererBill = CatererBills.objects.get(caterer=allocation.caterer,semester=period.semester)
Expand Down
6 changes: 3 additions & 3 deletions home/utils/rebate_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def is_not_duplicate(student,new_rebate_start,new_rebate_end):
"""Checks if these dates are already applied for rebate"""
try:
for short_rebate in Rebate.objects.filter(email=student).all():
if (short_rebate.start_date-timedelta(days=2) < new_rebate_start<short_rebate.end_date+timedelta(days=2)) or (short_rebate.start_date-timedelta(days=2)<new_rebate_end<short_rebate.end_date+timedelta(days=2)):
if (short_rebate.start_date-timedelta(days=2) < new_rebate_start<short_rebate.end_date+timedelta(days=1)) or (short_rebate.start_date-timedelta(days=2)<new_rebate_end<short_rebate.end_date+timedelta(days=1)):
return False
for short_rebate in LeftShortRebate.objects.filter(email=student).all():
if (short_rebate.start_date-timedelta(days=2) < new_rebate_start<short_rebate.end_date+timedelta(days=2)) or (short_rebate.start_date-timedelta(days=2)<new_rebate_end<short_rebate.end_date+timedelta(days=2)):
if (short_rebate.start_date-timedelta(days=2) < new_rebate_start<short_rebate.end_date+timedelta(days=1)) or (short_rebate.start_date-timedelta(days=2)<new_rebate_end<short_rebate.end_date+timedelta(days=1)):
return False
for long_rebate in LongRebate.objects.filter(email=student).all():
if (long_rebate.end_date+timedelta(days=2)> new_rebate_start>long_rebate.start_date-timedelta(days=2)) or (long_rebate.start_date-timedelta(days=2)<new_rebate_end<long_rebate.end_date+timedelta(days=2)):
if (long_rebate.end_date+timedelta(days=2)> new_rebate_start>long_rebate.start_date-timedelta(days=2)) or (long_rebate.start_date-timedelta(days=2)<new_rebate_end<long_rebate.end_date+timedelta(days=1)):
return False
return True
except Exception as e:
Expand Down

0 comments on commit 0968c3f

Please sign in to comment.