mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Cleaned up logic for calculating power draw
This commit is contained in:
@@ -166,6 +166,22 @@ def fgcolor(value):
|
||||
return '#{}'.format(foreground_color(value))
|
||||
|
||||
|
||||
@register.filter()
|
||||
def divide(x, y):
|
||||
"""
|
||||
Return x/y (rounded).
|
||||
"""
|
||||
return round(x / y)
|
||||
|
||||
|
||||
@register.filter()
|
||||
def percentage(x, y):
|
||||
"""
|
||||
Return x/y as a percentage.
|
||||
"""
|
||||
return round(x / y * 100)
|
||||
|
||||
|
||||
#
|
||||
# Tags
|
||||
#
|
||||
|
Reference in New Issue
Block a user