diff --git a/home/utils/rebate_bills_saver.py b/home/utils/rebate_bills_saver.py index e730140..c21409f 100644 --- a/home/utils/rebate_bills_saver.py +++ b/home/utils/rebate_bills_saver.py @@ -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) diff --git a/home/utils/rebate_checker.py b/home/utils/rebate_checker.py index e236650..a36eb54 100644 --- a/home/utils/rebate_checker.py +++ b/home/utils/rebate_checker.py @@ -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 new_rebate_start>long_rebate.start_date-timedelta(days=2)) or (long_rebate.start_date-timedelta(days=2) new_rebate_start>long_rebate.start_date-timedelta(days=2)) or (long_rebate.start_date-timedelta(days=2)