From 335c8f79bf84ea01a222de8133ad8cc3ba9db34f Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Mon, 10 May 2021 13:30:45 +0200 Subject: [PATCH] add clean req --- web/db.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web/db.py b/web/db.py index b65eabe..b80fbb9 100644 --- a/web/db.py +++ b/web/db.py @@ -126,7 +126,10 @@ class Database: def clean_battery(conn): # delete charging longer than 17h conn.execute("DElETE FROM battery WHERE JULIANDAY(stop_at)-JULIANDAY(start_at)>0.7;") - conn.execute("DELETE FROM battery WHERE start_level==end_level;") + # delete charging not finished longer than 17h + conn.execute("DELETE from battery where stop_at is NULL and JULIANDAY()-JULIANDAY(start_at)>0.7;") + #delete little charge + conn.execute("DELETE FROM battery WHERE start_level >= end_level-1;") @staticmethod def clean_position(conn):