1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #4838: Fix rack power utilization display for racks without devices

This commit is contained in:
Jeremy Stretch
2020-07-10 15:59:27 -04:00
parent a260019a7f
commit fa9ffb23ad
2 changed files with 2 additions and 1 deletions

View File

@@ -787,7 +787,7 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
)
if power_stats:
allocated_draw_total = sum(x['allocated_draw_total'] for x in power_stats)
allocated_draw_total = sum(x['allocated_draw_total'] or 0 for x in power_stats)
available_power_total = sum(x['available_power'] for x in power_stats)
return int(allocated_draw_total / available_power_total * 100) or 0
return 0