Fixed some type problems with local history

This commit is contained in:
Maximilian Giller 2024-05-06 22:13:57 +02:00
parent 07c6ff492e
commit 78a5b3d8ca

View file

@ -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 :]