From ff0f2a36019a7e24691bdc8fff77c59c30ec1788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Sun, 17 Aug 2025 18:12:31 +0200 Subject: [PATCH] zmiany w /all_products, laczenie item i sugested --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index b106d2e..aff2f6b 100644 --- a/app.py +++ b/app.py @@ -2103,11 +2103,11 @@ def all_products(): ) if sort == "alphabetical": - final_q = final_q.order_by(func.lower(final_q.c.display_name).asc()) + final_q = final_q.order_by(func.lower(union_q.c.display_name).asc()) else: - final_q = final_q.order_by(func.sum(union_q.c.count).desc(), func.lower(final_q.c.display_name).asc()) + final_q = final_q.order_by(func.sum(union_q.c.count).desc(), func.lower(union_q.c.display_name).asc()) - total_count = final_q.count() + total_count = db.session.query(func.count()).select_from(final_q.subquery()).scalar() products = final_q.offset(offset).limit(limit).all() out = [{"name": row.display_name, "count": row.count} for row in products]