cast hours to int #56

This commit is contained in:
weeman 2021-11-22 20:27:33 +01:00
parent 1287893698
commit 111d4f08f4
Signed by: weeman
GPG Key ID: 34F0524D4DA694A1

View File

@ -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)