[FIX] Devision by zero in decimal_widthratio template tag

Fixes: #1343
This commit is contained in:
Peter Pfeufer 2022-05-12 13:27:26 +02:00
parent 9e139495ac
commit 8dd07b97c7
No known key found for this signature in database
GPG Key ID: 6051D2C6AD4EBC27

View File

@ -38,6 +38,9 @@ logger = logging.getLogger(__name__)
@register.simple_tag()
def decimal_widthratio(this_value, max_value, max_width) -> str:
if max_value == 0:
return 0
return str(round(this_value/max_value * max_width, 2))