From 9dcd144b34e2179bc973f2675af5542993a88be6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Tue, 15 Jul 2025 23:27:54 +0200 Subject: [PATCH] funckja niekupione - poprawki w szablonie i backendzie --- app.py | 12 +++++++++++- templates/list.html | 3 +++ templates/list_share.html | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index cae872b..a68b6f7 100644 --- a/app.py +++ b/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/', methods=['POST']) diff --git a/templates/list.html b/templates/list.html index b0f9838..382a300 100644 --- a/templates/list.html +++ b/templates/list.html @@ -106,6 +106,9 @@ Lista: {{ list.title }} {% if item.note %} [ {{ item.note }} ] {% endif %} + {% if item.not_purchased_reason %} + [ Powód: {{ item.not_purchased_reason }} ] + {% endif %}
{% if item.not_purchased %}