From 78a5b3d8ca003f6eb5420945989f0091ad0275e9 Mon Sep 17 00:00:00 2001 From: Maximilian Giller Date: Mon, 6 May 2024 22:13:57 +0200 Subject: [PATCH] Fixed some type problems with local history --- src/endpoints/handlers/bett.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/endpoints/handlers/bett.py b/src/endpoints/handlers/bett.py index 1efb5d2..c3f7e76 100644 --- a/src/endpoints/handlers/bett.py +++ b/src/endpoints/handlers/bett.py @@ -93,7 +93,7 @@ def check_for_change(): # Make sure there is a bed_weight global empty_weight if empty_weight is None: - clusters = get_clusters(local_history) + clusters = get_clusters([d["total"] for d in local_history]) empty_weight = min([median(cluster) for cluster in clusters.values()]) # Determine number of people @@ -124,9 +124,7 @@ def add_weights_to_log(tl: float, tr: float, bl: float, br: float): timestamp = datetime.now() global local_history - local_history.append( - {"tl": tl, "tr": tr, "bl": bl, "br": br, "total": total, "timestamp": timestamp} - ) + local_history.append({"tl": tl, "tr": tr, "bl": bl, "br": br, "total": total}) if len(local_history): local_history = local_history[len(local_history) - history_max_length :]