|
|
|
|
@ -167,8 +167,19 @@ class SchoolPayment(Payment): |
|
|
|
|
models.Sum('month_price'), |
|
|
|
|
) |
|
|
|
|
if self.add_days: |
|
|
|
|
_school_payment = SchoolPayment.objects.filter( |
|
|
|
|
add_days=False, |
|
|
|
|
date_start__lte=self.date_start, |
|
|
|
|
date_end__gte=self.date_end, |
|
|
|
|
status__in=[ |
|
|
|
|
Pingback.PINGBACK_TYPE_REGULAR, |
|
|
|
|
Pingback.PINGBACK_TYPE_GOODWILL, |
|
|
|
|
Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED, |
|
|
|
|
], |
|
|
|
|
).last() |
|
|
|
|
weekday_count = weekday_in_date_range(self.date_start, self.date_end, self.weekdays[0]) |
|
|
|
|
month_price_sum = aggregate.get('month_price__sum', 0) * weekday_count / 30 |
|
|
|
|
all_weekday_count = weekday_in_date_range(_school_payment.date_start, _school_payment.date_end, self.weekdays[0]) |
|
|
|
|
month_price_sum = aggregate.get('month_price__sum', 0) * weekday_count // all_weekday_count |
|
|
|
|
else: |
|
|
|
|
month_price_sum = aggregate.get('month_price__sum', 0) |
|
|
|
|
if month_price_sum > config.SERVICE_DISCOUNT_MIN_AMOUNT: |
|
|
|
|
|