poprawki w jogice js, progressbar warstwowy i fix w notatkach
This commit is contained in:
18
app.py
18
app.py
@@ -1308,16 +1308,21 @@ def main_page():
|
||||
db.session.query(
|
||||
Item.list_id,
|
||||
func.count(Item.id).label("total_count"),
|
||||
func.sum(case((Item.purchased == True, 1), else_=0)).label(
|
||||
"purchased_count"
|
||||
),
|
||||
func.sum(case((Item.purchased == True, 1), else_=0)).label("purchased_count"),
|
||||
func.sum(case((Item.not_purchased == True, 1), else_=0)).label("not_purchased_count"),
|
||||
)
|
||||
.filter(Item.list_id.in_(all_ids))
|
||||
.group_by(Item.list_id)
|
||||
.all()
|
||||
)
|
||||
|
||||
stats_map = {
|
||||
s.list_id: (s.total_count or 0, s.purchased_count or 0) for s in stats
|
||||
s.list_id: (
|
||||
s.total_count or 0,
|
||||
s.purchased_count or 0,
|
||||
s.not_purchased_count or 0
|
||||
)
|
||||
for s in stats
|
||||
}
|
||||
|
||||
latest_expenses_map = dict(
|
||||
@@ -1330,9 +1335,10 @@ def main_page():
|
||||
)
|
||||
|
||||
for l in all_lists:
|
||||
total_count, purchased_count = stats_map.get(l.id, (0, 0))
|
||||
total_count, purchased_count, not_purchased_count = stats_map.get(l.id, (0, 0, 0))
|
||||
l.total_count = total_count
|
||||
l.purchased_count = purchased_count
|
||||
l.not_purchased_count = not_purchased_count
|
||||
l.total_expense = latest_expenses_map.get(l.id, 0)
|
||||
|
||||
l.category_badges = [
|
||||
@@ -1343,6 +1349,7 @@ def main_page():
|
||||
for l in all_lists:
|
||||
l.total_count = 0
|
||||
l.purchased_count = 0
|
||||
l.not_purchased_count = 0
|
||||
l.total_expense = 0
|
||||
l.category_badges = []
|
||||
|
||||
@@ -1356,6 +1363,7 @@ def main_page():
|
||||
)
|
||||
|
||||
|
||||
|
||||
@app.route("/system-auth", methods=["GET", "POST"])
|
||||
def system_auth():
|
||||
if (
|
||||
|
Reference in New Issue
Block a user