do not crap out when no tickets exist
This commit is contained in:
parent
b5dd97e935
commit
929cde010e
|
@ -231,7 +231,8 @@ class ShopTicketStatsDetailView(CampViewMixin, OrgaTeamPermissionMixin, ListView
|
|||
context["total_income"] += product.total_income
|
||||
context["total_cost"] += product.total_cost
|
||||
context["total_profit"] += product.total_profit
|
||||
context["average_price"] = round(
|
||||
context["total_income"] / context["total_units"], 2
|
||||
)
|
||||
if context["total_income"] and context["total_units"]:
|
||||
context["average_price"] = round(
|
||||
context["total_income"] / context["total_units"], 2
|
||||
)
|
||||
return context
|
||||
|
|
Loading…
Reference in a new issue