zmiany w /all_products, laczenie item i sugested
This commit is contained in:
6
app.py
6
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]
|
||||
|
Reference in New Issue
Block a user