fix w sugestiach

This commit is contained in:
Mateusz Gruszczyński
2025-08-15 22:25:22 +02:00
parent 71b14411e5
commit 028ae3c26e

11
app.py
View File

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