From cbf5c2ec1d8c0fe99f94bd21d3d16bcef4432ed9 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 8 Feb 2019 13:59:05 +0100 Subject: [PATCH] Fix ZeroDivisionError if a voucher tag is given to a voucher with max_usages=0 Fix PRETIXEU-V7 --- src/pretix/control/views/vouchers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pretix/control/views/vouchers.py b/src/pretix/control/views/vouchers.py index 3325123a9..81f906587 100644 --- a/src/pretix/control/views/vouchers.py +++ b/src/pretix/control/views/vouchers.py @@ -105,7 +105,10 @@ class VoucherTags(EventPermissionRequiredMixin, TemplateView): redeemed=Sum('redeemed') ) for t in tags: - t['percentage'] = int((t['redeemed'] / t['total']) * 100) + if t['total'] == 0: + t['percentage'] = 0 + else: + t['percentage'] = int((t['redeemed'] / t['total']) * 100) ctx['tags'] = tags return ctx