Changeset - 3651d7a7fb2a
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2019-12-16 20:16:00
brettcsmith@brettcsmith.org
templatetags: Don't let the donation amount go negative.

To account for ticket vouchers.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pinaxcon/templatetags/nbpy_tags.py
Show inline comments
...
 
@@ -35,13 +35,13 @@ def donation_income(context, invoice):
 
    '''
 

	
 
    tickets = inventory.Product.objects.filter(category__id=settings.TICKET_PRODUCT_CATEGORY)
 
    cheapest_ticket = tickets.order_by('price').first()
 
    ticket_rbi = nonvat_price(cheapest_ticket)
 
    return sum(
 
        (nonvat_price(ticket) - ticket_rbi
 
        (max(nonvat_price(ticket) - ticket_rbi, 0)
 
         for ticket in invoice.lineitem_set.filter(product__in=tickets)),
 
        Decimal(0)).quantize(CENTS_QUANT)
 

	
 

	
 
# TODO: include van/de/van der/de la/etc etc etc
 

	
0 comments (0 inline, 0 general)