fix(dashboard): sort recent activity by updated_at so delivered/received cards also appear
This commit is contained in:
@@ -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")
|
received = sum(1 for c in all_cards if c.status == "received")
|
||||||
countries = len({c.country for c in all_cards if c.country})
|
countries = len({c.country for c in all_cards if c.country})
|
||||||
|
|
||||||
# recent postcards across all profiles (last 8)
|
# recent postcards across all profiles (last 8), sorted by most recently updated
|
||||||
all_cards.sort(key=lambda c: c.created_at, reverse=True)
|
all_cards.sort(key=lambda c: c.updated_at or c.created_at, reverse=True)
|
||||||
recent = all_cards[:8]
|
recent = all_cards[:8]
|
||||||
|
|
||||||
# status distribution for progress bar
|
# status distribution for progress bar
|
||||||
|
|||||||
Reference in New Issue
Block a user