poprawa logiki liczenia w panelu
This commit is contained in:
14
app.py
14
app.py
@@ -755,13 +755,13 @@ def get_admin_expense_summary():
|
||||
total = base_query.scalar() or 0
|
||||
year_total = (
|
||||
base_query.filter(
|
||||
extract("year", Expense.added_at) == current_year
|
||||
extract("year", ShoppingList.created_at) == current_year
|
||||
).scalar()
|
||||
or 0
|
||||
)
|
||||
month_total = (
|
||||
base_query.filter(extract("year", Expense.added_at) == current_year)
|
||||
.filter(extract("month", Expense.added_at) == current_month)
|
||||
base_query.filter(extract("year", ShoppingList.created_at) == current_year)
|
||||
.filter(extract("month", ShoppingList.created_at) == current_month)
|
||||
.scalar()
|
||||
or 0
|
||||
)
|
||||
@@ -780,10 +780,10 @@ def get_admin_expense_summary():
|
||||
base.filter(
|
||||
ShoppingList.is_archived == False,
|
||||
~(
|
||||
(ShoppingList.is_temporary == True) &
|
||||
(ShoppingList.expires_at != None) &
|
||||
(ShoppingList.expires_at <= now)
|
||||
)
|
||||
(ShoppingList.is_temporary == True)
|
||||
& (ShoppingList.expires_at != None)
|
||||
& (ShoppingList.expires_at <= now)
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user