fix(dashboard): update sync card after completion + use Bucharest timezone

Sync card was showing previous run data after sync completed because the
last_run query excluded the current run_id even after it finished. Now only
excludes during active running state.

All datetime.now() and SQLite datetime('now') replaced with Europe/Bucharest
timezone to fix times displayed 2 hours behind (was using UTC).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-17 13:02:18 +00:00
parent f5ef9e0811
commit f74322beab
3 changed files with 34 additions and 16 deletions

View File

@@ -68,12 +68,14 @@ async def sync_status():
# Build last_run from most recent completed/failed sync_runs row
current_run_id = status.get("run_id")
is_running = status.get("status") == "running"
last_run = None
try:
from ..database import get_sqlite
db = await get_sqlite()
try:
if current_run_id:
if current_run_id and is_running:
# Only exclude current run while it's actively running
cursor = await db.execute("""
SELECT * FROM sync_runs
WHERE status IN ('completed', 'failed') AND run_id != ?