disable adding new languages
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
weeman 2021-11-22 21:31:17 +01:00
parent 9baf08d6b6
commit a3919d5d51
Signed by: weeman
GPG Key ID: 34F0524D4DA694A1

View File

@ -30,16 +30,10 @@ def update_languages(profile, languages_data):
profile_language_ids = [] profile_language_ids = []
for language_data in languages_data: for language_data in languages_data:
if "id" in language_data["language"]: if "id" not in language_data["language"]:
continue
language = Language.query.get(language_data["language"]["id"]) language = Language.query.get(language_data["language"]["id"])
else:
language_name = language_data["language"]["name"]
language = Language.query.filter(Language.name == language_name).first()
if language is None:
language = Language(id=language_name, name=language_name)
db.session.add(language)
profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile, profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile,
ProfileLanguage.language == language).first() ProfileLanguage.language == language).first()