funkcja_niekupione #2

Merged
gru merged 14 commits from funkcja_niekupione into master 2025-07-18 22:07:29 +02:00
3 changed files with 17 additions and 1 deletions
Showing only changes of commit 9dcd144b34 - Show all commits

12
app.py
View File

@@ -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'])

View File

@@ -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"

View File

@@ -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 %}