From ddeec36a0132de368d58e1bc4daf1e14c2f75beb Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Wed, 15 Jul 2026 19:40:42 +0800 Subject: [PATCH] fix(dashboard): exclude pending postcards from sent stat count --- app/routers/web.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routers/web.py b/app/routers/web.py index 4321eb3..0ab8cc5 100644 --- a/app/routers/web.py +++ b/app/routers/web.py @@ -590,7 +590,7 @@ def dashboard(request: Request, user: User = Depends(get_current_user_web), db: all_cards.extend(cards) total = len(all_cards) - sent = sum(1 for c in all_cards if c.status in ("pending", "sent")) + sent = sum(1 for c in all_cards if c.status == "sent") delivered = sum(1 for c in all_cards if c.status == "delivered") received = sum(1 for c in all_cards if c.status == "received") countries = len({c.country_to for c in all_cards if c.country_to}) @@ -642,7 +642,7 @@ def profile_list(request: Request, user: User = Depends(get_current_user_web), d cards = db.query(Postcard).filter(Postcard.profile_id == p.id).all() extras[p.id] = { "total": len(cards), - "sent": sum(1 for c in cards if c.status in ("pending", "sent")), + "sent": sum(1 for c in cards if c.status == "sent"), "delivered": sum(1 for c in cards if c.status == "delivered"), "received": sum(1 for c in cards if c.status == "received"), "countries": len({c.country_to for c in cards if c.country_to}),