From 94f7d0aab51e2b6c4b22b110544925cf0fe3f6e5 Mon Sep 17 00:00:00 2001 From: Lakshya Singh Date: Tue, 20 Oct 2020 04:16:54 +0530 Subject: [PATCH] lowercase search languages (#398) convert key and search to lowercase prevent duplicate insertion Co-authored-by: Aaron Suarez --- app/api/routes/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/routes/helpers.py b/app/api/routes/helpers.py index d38c3bfa..4192268c 100644 --- a/app/api/routes/helpers.py +++ b/app/api/routes/helpers.py @@ -19,12 +19,12 @@ def get_attributes(json): languages_list = Language.query.all() categories_list = Category.query.all() - language_dict = {lang.key(): lang for lang in languages_list} + language_dict = {lang.key().lower(): lang for lang in languages_list} category_dict = {c.key(): c for c in categories_list} langs = [] for lang in json.get('languages') or []: - language = language_dict.get(lang) + language = language_dict.get(lang.lower()) if not language: language = Language(name=lang) langs.append(language)