From 84ca3aee736779e6a62a4637d35c46e5f3945565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Thu, 31 Jul 2025 13:06:38 +0200 Subject: [PATCH] poprawa logiki liczenia w panelu --- app.py | 11 ++++++++--- templates/admin/admin_panel.html | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index 21bb029..d6c2b15 100644 --- a/app.py +++ b/app.py @@ -779,7 +779,11 @@ def get_admin_expense_summary(): active_lists = calc_sum( base.filter( ShoppingList.is_archived == False, - or_(ShoppingList.expires_at == None, ShoppingList.expires_at > now), + ~( + (ShoppingList.is_temporary == True) & + (ShoppingList.expires_at != None) & + (ShoppingList.expires_at <= now) + ) ) ) @@ -790,8 +794,9 @@ def get_admin_expense_summary(): expired_lists = calc_sum( base.filter( ShoppingList.is_archived == False, - ShoppingList.expires_at != None, - ShoppingList.expires_at <= now, + (ShoppingList.is_temporary == True), + (ShoppingList.expires_at != None), + (ShoppingList.expires_at <= now), ) ) diff --git a/templates/admin/admin_panel.html b/templates/admin/admin_panel.html index fd839e2..1ab8ed0 100644 --- a/templates/admin/admin_panel.html +++ b/templates/admin/admin_panel.html @@ -59,7 +59,7 @@
{{ name }} - {{ count }}× + {{ count }}×
{% endfor %} {% else %} -

Brak danych

- {% endif %} + Brak danych

+ {% endif %}
-- 2.43.0