Update nbpy_tags.py

Fixes donation amount
This commit is contained in:
Christopher Neugebauer 2017-10-31 10:34:26 -07:00 committed by GitHub
parent ff8d0f4c41
commit e144ebf41d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,5 +40,5 @@ def donation_income(context, invoice):
elif line.product.category.name == "T-Shirt": elif line.product.category.name == "T-Shirt":
rbi.append(line.total_price * fsa_rate) rbi.append(line.total_price * fsa_rate)
donation = (invoice.value - sum(rbi)) donation = max(Decimal('0'), (invoice.value - sum(rbi)))
return donation.quantize(Decimal('.01')) return donation.quantize(Decimal('.01'))