From 5b549e0e70da50f36db0a4e3a71dfe6b1f77d2ea Mon Sep 17 00:00:00 2001 From: James Wang Date: Fri, 8 Apr 2016 10:57:36 -0400 Subject: [PATCH] Fix team registration --- server/api/team.py | 3 +-- server/api/user.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) 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: