diff --git a/BackEndFlask/controller/Routes/Completed_assessment_routes.py b/BackEndFlask/controller/Routes/Completed_assessment_routes.py index ced1c1ef3..5b44a59f3 100644 --- a/BackEndFlask/controller/Routes/Completed_assessment_routes.py +++ b/BackEndFlask/controller/Routes/Completed_assessment_routes.py @@ -187,15 +187,23 @@ def add_completed_assessment(): @admin_check() def update_completed_assessment(): try: + assessment_data = request.json + team_id = int(assessment_data["team_id"]) + if (team_id == -1): + assessment_data["team_id"] = None + user_id = int(assessment_data["user_id"]) + if (user_id == -1): + assessment_data["user_id"] = None + completed_assessment_id = request.args.get("completed_assessment_id") updated_completed_assessment = None if(completed_assessment_id): - updated_completed_assessment = replace_completed_assessment(request.json, completed_assessment_id) + updated_completed_assessment = replace_completed_assessment(assessment_data, completed_assessment_id) else: - updated_completed_assessment = create_completed_assessment(request.json) + updated_completed_assessment = create_completed_assessment(assessment_data) return create_good_response(completed_assessment_schema.dump(updated_completed_assessment), 201, "completed_assessments")