Merge branch 'fix-decimal_widthratio-template-tag' into 'v3.x'

[FIX] Division by zero in decimal_widthratio template tag

See merge request allianceauth/allianceauth!1419
This commit is contained in:
Ariel Rin 2022-05-12 13:33:17 +00:00
commit 4836559abe

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 str(0)
return str(round(this_value/max_value * max_width, 2))