Compare commits
No commits in common. "a3919d5d51d6f2ae168dc7fe36fbe47e25bdec97" and "733499303f44fbfb3940f71d54554263aa45c30f" have entirely different histories.
a3919d5d51
...
733499303f
@ -30,10 +30,16 @@ def update_languages(profile, languages_data):
|
||||
profile_language_ids = []
|
||||
|
||||
for language_data in languages_data:
|
||||
if "id" not in language_data["language"]:
|
||||
continue
|
||||
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)
|
||||
|
||||
language = Language.query.get(language_data["language"]["id"])
|
||||
profile_language = ProfileLanguage.query.filter(ProfileLanguage.profile == profile,
|
||||
ProfileLanguage.language == language).first()
|
||||
|
||||
@ -144,7 +150,7 @@ def update_profile(user_id: int):
|
||||
try:
|
||||
availability_hours_per_week = int(availability_hours_per_week_raw)
|
||||
except:
|
||||
availability_hours_per_week = None
|
||||
availability_hours_per_week = 0
|
||||
|
||||
profile.availability_hours_per_week = availability_hours_per_week
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user