renamed variables

This commit is contained in:
Kristian Krsnik 2023-10-04 18:39:47 +02:00
parent 8d070a059c
commit c27a19da56
Signed by: Kristian
GPG Key ID: FD1330AC9F909E85

View File

@ -63,11 +63,11 @@ def printOutages(filepath: str, time: int) -> None:
last_failed = False
# Print the outages.
for outage in outages:
for outage_start, outage_end in [(outage[0], outage[-1]) for outage in outages]:
# Get duration of outage in hours and minutes.
outage_duration = round(
(outage[-1].date - outage[0].date).seconds / 60
(outage_end.date - outage_start.date).seconds / 60
)
# Skip printing if outage is shorter than the minimum duration.
@ -77,10 +77,10 @@ def printOutages(filepath: str, time: int) -> None:
# Get hours and minutes for printing.
hours = outage_duration // 60
minutes = outage_duration - (hours * 60)
host = outage[0].host
host = outage_start.host
# Outputs outages in the form of "Outage at: 2023-19-01 06:29:01 lasting for 2 Hours and 39 Minutes".
print(f"[{outage[0].date}][{host}] lasting for {'{} Hours and '.format(hours) if hours >= 1 else ''}{minutes} Minutes")
print(f"[{outage_start.date}][{host}] lasting for {'{} Hours and '.format(hours) if hours >= 1 else ''}{minutes} Minutes")
def isOnline(host: str, timeout: int) -> bool: