Compare commits
2 Commits
733499303f
...
a3919d5d51
Author | SHA1 | Date | |
---|---|---|---|
a3919d5d51 | |||
9baf08d6b6 |
@ -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()
|
||||||
|
|
||||||
@ -150,7 +144,7 @@ def update_profile(user_id: int):
|
|||||||
try:
|
try:
|
||||||
availability_hours_per_week = int(availability_hours_per_week_raw)
|
availability_hours_per_week = int(availability_hours_per_week_raw)
|
||||||
except:
|
except:
|
||||||
availability_hours_per_week = 0
|
availability_hours_per_week = None
|
||||||
|
|
||||||
profile.availability_hours_per_week = availability_hours_per_week
|
profile.availability_hours_per_week = availability_hours_per_week
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user