From 028ae3c26e72e679ca72b35366a9ef861edc6830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gruszczy=C5=84ski?= Date: Fri, 15 Aug 2025 22:25:22 +0200 Subject: [PATCH] fix w sugestiach --- app.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 4da2de1..1b0ab05 100644 --- a/app.py +++ b/app.py @@ -960,6 +960,10 @@ def get_active_months_query(visible_lists_query=None): return [row.month for row in active_months] +def normalize_name(name): + return (name or "").strip().lower() + + ############# OCR ########################### @@ -2849,7 +2853,7 @@ def list_products(): seen_names = set() unique_items = [] for item in all_items: - key = (item.name or "").strip().lower() + key = normalize_name(item.name) if key not in seen_names: unique_items.append(item) seen_names.add(key) @@ -2874,12 +2878,13 @@ def list_products(): users_dict = {u.id: u.username for u in users} suggestions = SuggestedProduct.query.all() + all_suggestions_dict = { - (s.name or "").strip().lower(): s + normalize_name(s.name): s for s in suggestions if s.name and s.name.strip() } - used_suggestion_names = {(i.name or "").strip().lower() for i in unique_items} + used_suggestion_names = {normalize_name(i.name) for i in unique_items} suggestions_dict = { name: all_suggestions_dict[name]