From 81811b4071d71570992f124cb52aff310a0f31d5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 8 Oct 2025 11:40:30 +0800 Subject: [PATCH] fix timestamp casting and datetime conversion in data settings --- app/ui/views/settings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/ui/views/settings.py b/app/ui/views/settings.py index fcacad3..28d36a2 100644 --- a/app/ui/views/settings.py +++ b/app/ui/views/settings.py @@ -583,7 +583,10 @@ def render_data_settings() -> None: with db_session() as session: df = pd.read_sql_query( """ - SELECT job_type, status, created_at, updated_at, error_msg + SELECT job_type, status, + CAST(created_at AS TIMESTAMP) as created_at, + CAST(updated_at AS TIMESTAMP) as updated_at, + error_msg FROM fetch_jobs ORDER BY created_at DESC LIMIT 50 @@ -592,7 +595,7 @@ def render_data_settings() -> None: ) if not df.empty: - df["duration"] = (df["updated_at"] - df["created_at"]).dt.total_seconds().round(2) + df["duration"] = (pd.to_datetime(df["updated_at"]) - pd.to_datetime(df["created_at"])).dt.total_seconds().round(2) df = df.drop(columns=["updated_at"]) df = df.rename(columns={ "job_type": "数据类型",