Skip to content

Commit e6f41e0

Browse files
committed
Refactor timestamp formatting in dashboard routes for clarity
1 parent f27b090 commit e6f41e0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

dashboard/routes.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def index(request: Request):
5656

5757
# Parse the ISO format timestamp and format it to show date and time
5858
dt = datetime.fromisoformat(latest_timestamp.replace("Z", "+00:00"))
59-
latest_timestamp_str = dt.strftime("%Y-%m-%d %H:%M:%S")
6059

6160
# Calculate time difference
6261
now = datetime.now(dt.tzinfo)
@@ -66,18 +65,18 @@ def index(request: Request):
6665
if diff_seconds < 3600: # Less than 1 hour
6766
minutes_ago = round(diff_seconds / 60, 1)
6867
time_ago_str = (
69-
f"({minutes_ago:.1f} minute{'s' if minutes_ago != 1 else ''} ago)"
68+
f"{minutes_ago:.1f} minute{'s' if minutes_ago != 1 else ''} ago"
7069
)
7170
elif diff_seconds < 86400: # Less than 24 hours
7271
hours_ago = round(diff_seconds / 3600, 1)
7372
time_ago_str = (
74-
f"({hours_ago:.1f} hour{'s' if hours_ago != 1 else ''} ago)"
73+
f"{hours_ago:.1f} hour{'s' if hours_ago != 1 else ''} ago"
7574
)
7675
else: # Days or more
7776
days_ago = round(diff_seconds / 86400, 1)
78-
time_ago_str = f"({days_ago:.1f} day{'s' if days_ago != 1 else ''} ago)"
77+
time_ago_str = f"{days_ago:.1f} day{'s' if days_ago != 1 else ''} ago"
7978

80-
latest_timestamp = f"{latest_timestamp_str} {time_ago_str}"
79+
latest_timestamp = f"{time_ago_str}"
8180

8281
batch_stats[batch_name] = {
8382
"unique_metrics": len(df["metric_name"].unique()),

0 commit comments

Comments
 (0)