mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
minor tweaks to error handling to allow for defaulted values from pre v2.6 data
This commit is contained in:
@@ -171,6 +171,8 @@ def divide(x, y):
|
||||
"""
|
||||
Return x/y (rounded).
|
||||
"""
|
||||
if x is None or y is None:
|
||||
return None
|
||||
return round(x / y)
|
||||
|
||||
|
||||
@@ -179,6 +181,8 @@ def percentage(x, y):
|
||||
"""
|
||||
Return x/y as a percentage.
|
||||
"""
|
||||
if x is None or y is None:
|
||||
return None
|
||||
return round(x / y * 100)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user