Skip to content

Commit

Permalink
fix: heatmap fails when no hosts defined.
Browse files Browse the repository at this point in the history
* we should just display the page with no data instead of app error when
  during new installs someone runs --regen-heatmap.

Change-Id: I61116b1cc7e27617bab7e59500eb3d8097ab1a1e
  • Loading branch information
sadsfae committed Sep 27, 2024
1 parent 7f94aae commit 8492924
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/quads/tools/simple_table_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,12 @@ async def generator(self, _host_file, _days, _month, _year, _gentime):

total_hosts = len(hosts)
total_use = len(total_current_schedules)
utilization = 100 - (non_allocated_count * 100 // (_days * total_hosts))
utilization_daily = total_use * 100 // total_hosts
if int(total_hosts) == 0:
utilization_daily = 0
utilization = 0
else:
utilization = 100 - (non_allocated_count * 100 // (_days * total_hosts))
utilization_daily = total_use * 100 // total_hosts
with open(os.path.join(Config.TEMPLATES_PATH, "simple_table_emoji")) as _file:
template = Template(_file.read())
content = template.render(
Expand Down

0 comments on commit 8492924

Please sign in to comment.