Changeset - e144ebf41d69
[Not reviewed]
0 1 0
Christopher Neugebauer - 6 years ago 2017-10-31 17:34:26
_@chrisjrn.com
Update nbpy_tags.py

Fixes donation amount
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pinaxcon/templatetags/nbpy_tags.py
Show inline comments
...
 
@@ -19,26 +19,26 @@ def donation_income(context, invoice):
 
        the donation income.
 

	
 
    '''
 

	
 
    # 15% (FSA) goes to Conservancy; 85% is real goods
 

	
 
    fsa_rate = Decimal("0.85")
 
    rbi_full_ticket = Decimal("68.00")
 
    rbi_early_bird_discount = Decimal("-21.35")
 
    rbi = []
 

	
 
    for line in invoice.lineitem_set.all():
 
        if line.product.category.name == "Ticket":
 
            if line.product.name.startswith("Unaffiliated Individual"):
 
                # Includes full price & discounts
 
                rbi.append(line.total_price * fsa_rate)
 
            else:
 
                if line.total_price > 0:
 
                    rbi.append(rbi_full_ticket)
 
                elif line.total_price < 0:
 
                    rbi.append(rbi_early_bird_discount)
 
        elif line.product.category.name == "T-Shirt":
 
            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'))
0 comments (0 inline, 0 general)