fix(dashboard): sort recent activity by updated_at so delivered/received cards also appear

This commit is contained in:
2026-07-07 13:23:39 +08:00
parent a071b3dde4
commit b5716ff340

View File

@@ -595,8 +595,8 @@ def dashboard(request: Request, user: User = Depends(get_current_user_web), db:
received = sum(1 for c in all_cards if c.status == "received")
countries = len({c.country for c in all_cards if c.country})
# recent postcards across all profiles (last 8)
all_cards.sort(key=lambda c: c.created_at, reverse=True)
# recent postcards across all profiles (last 8), sorted by most recently updated
all_cards.sort(key=lambda c: c.updated_at or c.created_at, reverse=True)
recent = all_cards[:8]
# status distribution for progress bar