fix: pre-road audit (Phase 30) — upload-loop OSError, stats lock scope, server int guards
This commit is contained in:
+3
-1
@@ -504,6 +504,9 @@ def get_overview_stats():
|
||||
dtc_row = conn.execute(
|
||||
"SELECT COUNT(*) FROM dtc WHERE IS_SET = 1"
|
||||
).fetchone()
|
||||
cumul = conn.execute(
|
||||
"SELECT COALESCE(SUM(DISTANCE_KM), 0) FROM trips"
|
||||
).fetchone()
|
||||
from modules import app_video as _av
|
||||
try:
|
||||
video_count = sum(1 for _ in _av.list_local_videos().get("files", []))
|
||||
@@ -511,7 +514,6 @@ def get_overview_stats():
|
||||
video_count = 0
|
||||
from modules import app_settings
|
||||
base = app_settings._number_value("odometer_baseline", float, 0)
|
||||
cumul = conn.execute("SELECT COALESCE(SUM(DISTANCE_KM), 0) FROM trips").fetchone()
|
||||
computed = base + (cumul[0] if cumul else 0)
|
||||
return {
|
||||
"trip_count": row[0],
|
||||
|
||||
Reference in New Issue
Block a user