fix(dashboard): received country pie chart now groups by country_from (寄出国)
This commit is contained in:
1 file changed
+5
-3
+5
-3
@@ -616,12 +616,14 @@ def dashboard(request: Request, user: User = Depends(get_current_user_web), db:
|
||||
sent_country_counts: dict[str, int] = {}
|
||||
received_country_counts: dict[str, int] = {}
|
||||
for c in all_cards:
|
||||
if not c.country_to:
|
||||
continue
|
||||
if c.status in ("pending", "sent", "delivered"):
|
||||
if not c.country_to:
|
||||
continue
|
||||
sent_country_counts[c.country_to] = sent_country_counts.get(c.country_to, 0) + 1
|
||||
elif c.status == "received":
|
||||
received_country_counts[c.country_to] = received_country_counts.get(c.country_to, 0) + 1
|
||||
if not c.country_from:
|
||||
continue
|
||||
received_country_counts[c.country_from] = received_country_counts.get(c.country_from, 0) + 1
|
||||
sent_country_stats = sorted(sent_country_counts.items(), key=lambda x: -x[1])
|
||||
received_country_stats = sorted(received_country_counts.items(), key=lambda x: -x[1])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user