funckja niekupione - poprawki w szablonie i backendzie
This commit is contained in:
12
app.py
12
app.py
@@ -723,6 +723,7 @@ def all_products():
|
||||
top_products_query.order_by(
|
||||
SuggestedProduct.usage_count.desc(), SuggestedProduct.name.asc()
|
||||
)
|
||||
.distinct(SuggestedProduct.name)
|
||||
.limit(20)
|
||||
.all()
|
||||
)
|
||||
@@ -739,7 +740,16 @@ def all_products():
|
||||
|
||||
all_names = top_names + [s.name for s in rest_products]
|
||||
|
||||
return {"allproducts": all_names}
|
||||
seen = set()
|
||||
unique_names = []
|
||||
for name in all_names:
|
||||
name_lower = name.strip().lower()
|
||||
if name_lower not in seen:
|
||||
unique_names.append(name)
|
||||
seen.add(name_lower)
|
||||
|
||||
return {"allproducts": unique_names}
|
||||
|
||||
|
||||
|
||||
""" @app.route('/upload_receipt/<int:list_id>', methods=['POST'])
|
||||
|
@@ -106,6 +106,9 @@ Lista: <strong>{{ list.title }}</strong>
|
||||
{% if item.note %}
|
||||
<small class="text-danger ms-4">[ <b>{{ item.note }}</b> ]</small>
|
||||
{% endif %}
|
||||
{% if item.not_purchased_reason %}
|
||||
<small class="text-dark ms-4">[ <b>Powód: {{ item.not_purchased_reason }}</b> ]</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="mt-2 mt-md-0 d-flex gap-1">
|
||||
<button class="btn btn-sm btn-outline-warning"
|
||||
|
@@ -47,6 +47,9 @@
|
||||
{% if item.note %}
|
||||
<small class="text-danger ms-4">[ <b>{{ item.note }}</b> ]</small>
|
||||
{% endif %}
|
||||
{% if item.not_purchased_reason %}
|
||||
<small class="text-dark ms-4">[ <b>Powód: {{ item.not_purchased_reason }}</b> ]</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
{% if item.not_purchased %}
|
||||
|
Reference in New Issue
Block a user