python models: Supporter.supporter_type() handles untagged payments.

This commit is contained in:
Brett Smith 2017-02-17 15:11:32 -05:00
parent e2eab732ac
commit 8481bbf3b9

View file

@ -112,7 +112,12 @@ class Supporter:
return expose_wrapper
def _supporter_type(self, payments):
return payments.last().program.rsplit(':', 1)[-1]
for payment in payments.reverse():
if payment.program is not None:
break
else:
return None
return payment.program.rsplit(':', 1)[-1]
supporter_type = _expose(_supporter_type)
def _calculate_lapse_date(self, last_payment_date, supporter_type):