diff --git a/server/api/team.py b/server/api/team.py index cbde6be..a2bad53 100644 --- a/server/api/team.py +++ b/server/api/team.py @@ -29,15 +29,14 @@ def team_create(): school = params.get("school") team = Teams(teamname, school, _user.uid, _user.utype != 1) - tid = team.tid with app.app_context(): db.session.add(team) db.session.commit() Users.query.filter_by(uid=_user.uid).update({ "tid": team.tid }) db.session.commit() + session["tid"] = team.tid db.session.close() - session["tid"] = team.tid return { "success": 1, "message": "Success!" } @blueprint.route("/delete", methods=["POST"]) diff --git a/server/api/user.py b/server/api/user.py index 93b56b1..9a9acbf 100644 --- a/server/api/user.py +++ b/server/api/user.py @@ -133,7 +133,7 @@ def user_status(): "logged_in": logged_in, "admin": is_admin(), "competition": is_admin(), - "in_team": in_team(get_user()), + "in_team": in_team(get_user().first()), "username": session["username"] if logged_in else "", } if logged_in: