diff --git a/ki/handlers/update_profile.py b/ki/handlers/update_profile.py index 26a188c..06d107b 100644 --- a/ki/handlers/update_profile.py +++ b/ki/handlers/update_profile.py @@ -138,7 +138,16 @@ def update_profile(user_id: int): profile.volunteerwork = request.json.get("volunteerwork", "") profile.availability_status = request.json.get("availability_status", False) profile.availability_text = request.json.get("availability_text", "") - profile.availability_hours_per_week = request.json.get("availability_hours_per_week", 0) + + availability_hours_per_week_raw = request.json.get("availability_hours_per_week", 0) + + try: + availability_hours_per_week = int(availability_hours_per_week_raw) + except: + availability_hours_per_week = 0 + + profile.availability_hours_per_week = availability_hours_per_week + profile.freetext = request.json.get("freetext", "") profile.visible = request.json.get("visible", False)