forked from CGM_Public/pretix_original
Fix ZeroDivisionError if a voucher tag is given to a voucher with max_usages=0
Fix PRETIXEU-V7
This commit is contained in:
@@ -105,7 +105,10 @@ class VoucherTags(EventPermissionRequiredMixin, TemplateView):
|
|||||||
redeemed=Sum('redeemed')
|
redeemed=Sum('redeemed')
|
||||||
)
|
)
|
||||||
for t in tags:
|
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
|
ctx['tags'] = tags
|
||||||
return ctx
|
return ctx
|
||||||
|
|||||||
Reference in New Issue
Block a user