usuniecie zbednego kodu i poprawki
This commit is contained in:
12
app.py
12
app.py
@@ -2882,6 +2882,15 @@ def list_products():
|
||||
if name not in used_suggestion_names
|
||||
]
|
||||
|
||||
usage_counts = dict(
|
||||
db.session.query(
|
||||
func.lower(Item.name),
|
||||
func.coalesce(func.sum(Item.quantity), 0)
|
||||
)
|
||||
.group_by(func.lower(Item.name))
|
||||
.all()
|
||||
)
|
||||
|
||||
query_string = urlencode({k: v for k, v in request.args.items() if k != "page"})
|
||||
|
||||
return render_template(
|
||||
@@ -2894,7 +2903,8 @@ def list_products():
|
||||
per_page=per_page,
|
||||
total_pages=total_pages,
|
||||
query_string=query_string,
|
||||
total_items=total_items
|
||||
total_items=total_items,
|
||||
usage_counts=usage_counts
|
||||
)
|
||||
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
<th>ID</th>
|
||||
<th>Nazwa</th>
|
||||
<th>Dodany przez</th>
|
||||
<th>Ilość użyć</th>
|
||||
<th>Akcja</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -35,6 +36,7 @@
|
||||
-
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ usage_counts.get(item.name.lower(), 0) }}</td>
|
||||
<td>
|
||||
{% set suggestion = suggestions_dict.get(item.name.lower()) %}
|
||||
{% if suggestion %}
|
||||
|
Reference in New Issue
Block a user