Compare commits

...

2 Commits

Author SHA1 Message Date
a3919d5d51
disable adding new languages
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2021-11-22 21:31:17 +01:00
9baf08d6b6
set hours to None if unavailable 2021-11-22 21:23:35 +01:00

View File

@ -30,16 +30,10 @@ def update_languages(profile, languages_data):
profile_language_ids = []
for language_data in languages_data:
if "id" in language_data["language"]:
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)
if "id" not in language_data["language"]:
continue
language = Language.query.get(language_data["language"]["id"])
profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile,
ProfileLanguage.language == language).first()
@ -150,7 +144,7 @@ def update_profile(user_id: int):
try:
availability_hours_per_week = int(availability_hours_per_week_raw)
except:
availability_hours_per_week = 0
availability_hours_per_week = None
profile.availability_hours_per_week = availability_hours_per_week