Merge pull request 'poprawa logiki liczenia w panelu' (#9) from optymalizacje_kodu into master

Reviewed-on: #9
This commit is contained in:
gru
2025-07-31 13:07:10 +02:00
2 changed files with 11 additions and 6 deletions

11
app.py
View File

@@ -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),
)
)

View File

@@ -59,7 +59,7 @@
<div class="mb-2">
<div class="d-flex justify-content-between">
<span>{{ name }}</span>
<span class="text-muted">{{ count }}×</span>
<span class="badge rounded-pill bg-secondary opacity-75">{{ count }}×</span>
</div>
<div class="progress" style="height: 6px;">
<div class="progress-bar bg-success" role="progressbar" style="width: {{ (count / max_count) * 100 }}%"
@@ -69,8 +69,8 @@
</div>
{% endfor %}
{% else %}
<p class="text-muted mb-0">Brak danych</p>
{% endif %}
<span class="badge rounded-pill bg-secondary opacity-75">Brak danych</p>
{% endif %}
</div>
</div>
</div>