do not crap out when no tickets exist

This commit is contained in:
Thomas Steen Rasmussen 2021-08-01 17:43:53 +02:00
parent b5dd97e935
commit 929cde010e

View file

@ -231,6 +231,7 @@ class ShopTicketStatsDetailView(CampViewMixin, OrgaTeamPermissionMixin, ListView
context["total_income"] += product.total_income
context["total_cost"] += product.total_cost
context["total_profit"] += product.total_profit
if context["total_income"] and context["total_units"]:
context["average_price"] = round(
context["total_income"] / context["total_units"], 2
)