From dcdead591d46f4986e902a6e420fb9b3de766ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Thu, 11 Feb 2021 02:08:59 +0100 Subject: [PATCH] change up status descriptions --- generate.py | 12 ++++++++---- templates/index.html | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/generate.py b/generate.py index 9fa48b7..7c238e9 100644 --- a/generate.py +++ b/generate.py @@ -35,6 +35,7 @@ class Lease: @dataclass class Status: open: bool + description: str text: str @@ -127,12 +128,15 @@ def run_forever(address: str, period: int, ssid: str, output: str): logging.debug(", ".join([str(lease) for lease in registered_leases])) if len(registered_leases) > 0: - if len([lease for lease in registered_leases if _is_human(lease)]) > 0: - status = Status(open=True, text="There seem to be people!") + people_cnt = len([lease for lease in registered_leases if _is_human(lease)]) + if people_cnt > 3: + status = Status(open=True, description='FILLED', text="There seems to be a lot of people!") + elif people_cnt > 0: + status = Status(open=True, description='POPULATED', text="There seem to be people!") else: - status = Status(open=False, text="There are only computers.") + status = Status(open=False, description='EMPTY', text="There are only computers.") else: - status = Status(open=False, text="There are no devices connected?") + status = Status(open=False, description='VOID', text="There are no devices connected?") logging.debug("Logging into the database...") cur = db.cursor() diff --git a/templates/index.html b/templates/index.html index 1796e52..e04c873 100644 --- a/templates/index.html +++ b/templates/index.html @@ -59,7 +59,7 @@

STATUS

- {{'POPULATED' if status.open else 'EMPTY'}} + {{status.description}}
{{status.text}}