mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-15 07:20:17 +02:00
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 (cherry picked from commit 4836559abe800e8d0f5048502b5cdbcd37d14f8b) 8dd07b97 [FIX] Devision by zero in decimal_widthratio template tag 17b06c88 Make it a string in accordance to the return value type
This commit is contained in:
parent
5bde9a6952
commit
37b9f5c882
@ -38,6 +38,9 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
@register.simple_tag()
|
@register.simple_tag()
|
||||||
def decimal_widthratio(this_value, max_value, max_width) -> str:
|
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))
|
return str(round(this_value/max_value * max_width, 2))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user