python models: Implement Supporter.supperter_type() with filters.
This commit is contained in:
parent
8481bbf3b9
commit
2b1bdb073d
1 changed files with 5 additions and 5 deletions
|
@ -112,12 +112,12 @@ class Supporter:
|
|||
return expose_wrapper
|
||||
|
||||
def _supporter_type(self, payments):
|
||||
for payment in payments.reverse():
|
||||
if payment.program is not None:
|
||||
break
|
||||
else:
|
||||
try:
|
||||
program = payments.filter(program__isnull=False).reverse()[0].program
|
||||
except IndexError:
|
||||
return None
|
||||
return payment.program.rsplit(':', 1)[-1]
|
||||
else:
|
||||
return program.rsplit(':', 1)[-1]
|
||||
supporter_type = _expose(_supporter_type)
|
||||
|
||||
def _calculate_lapse_date(self, last_payment_date, supporter_type):
|
||||
|
|
Loading…
Reference in a new issue