From 90b6ea9ce588e9707bd516b832864f9479881889 Mon Sep 17 00:00:00 2001 From: Peter Oettig Date: Thu, 24 Jul 2025 22:12:46 +0200 Subject: [PATCH] fix: Charge price was tried to be set for unfinished chargings on application restart This made rendering the webview fail --- psa_car_controller/psacc/repository/db.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/psa_car_controller/psacc/repository/db.py b/psa_car_controller/psacc/repository/db.py index 024436f4..5474fc10 100644 --- a/psa_car_controller/psacc/repository/db.py +++ b/psa_car_controller/psacc/repository/db.py @@ -356,7 +356,8 @@ def get_charge(vin, start_at) -> Charge: @staticmethod def get_all_charge_without_price(conn) -> List[Charge]: - res = conn.execute("SELECT * FROM battery WHERE price IS NULL").fetchall() + # Chargings that did not end yet can't have a price + res = conn.execute("SELECT * FROM battery WHERE price IS NULL AND stop_at IS NOT NULL").fetchall() charges = [] for row in res: charges.append(Charge(**dict_key_to_lower_case(**row)))