fix(phase26): BUG-10 side effect — preserve trips when OBD never connected
This commit is contained in:
@@ -390,6 +390,11 @@ def refresh_trips(force=False):
|
|||||||
(rebuild_start_id,),
|
(rebuild_start_id,),
|
||||||
).fetchall()
|
).fetchall()
|
||||||
|
|
||||||
|
from modules import app_obd
|
||||||
|
if not app_obd.was_car_ever_connected():
|
||||||
|
# Never connected to the car — preserve existing trips, don't delete them.
|
||||||
|
return conn.execute("SELECT COUNT(*) FROM trips").fetchone()[0]
|
||||||
|
|
||||||
trips = app_trip.build_trip_summaries(rows)
|
trips = app_trip.build_trip_summaries(rows)
|
||||||
with _conn_lock:
|
with _conn_lock:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user