usuniecie zbednego kodu i poprawki
This commit is contained in:
15
app.py
15
app.py
@@ -2854,18 +2854,15 @@ def list_products():
|
||||
unique_items.append(item)
|
||||
seen_names.add(key)
|
||||
|
||||
stmt = (
|
||||
select(
|
||||
func.lower(func.trim(Item.name)).label("name_lower"),
|
||||
func.coalesce(func.sum(Item.quantity), 0).label("qty_sum"),
|
||||
usage_counts = dict(
|
||||
db.session.query(
|
||||
func.lower(Item.name),
|
||||
func.coalesce(func.sum(Item.quantity), 0)
|
||||
)
|
||||
.where(Item.name.isnot(None))
|
||||
.group_by(func.lower(func.trim(Item.name)))
|
||||
.group_by(func.lower(Item.name))
|
||||
.all()
|
||||
)
|
||||
|
||||
rows = db.session.execute(stmt).all()
|
||||
usage_counts = {name_lower: qty_sum for name_lower, qty_sum in rows}
|
||||
|
||||
total_items = len(unique_items)
|
||||
total_pages = (total_items + per_page - 1) // per_page
|
||||
start = (page - 1) * per_page
|
||||
|
Reference in New Issue
Block a user