fix w sugestiach
This commit is contained in:
11
app.py
11
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]
|
||||
|
Reference in New Issue
Block a user