def store_team(token, info): ''' Stores a validated team in the database ''' # Check if team exists team = Teams.query.get(info['team_id']) if team is None: # Create new team new_team = Teams(info['team_id']) new_team.token = token # Store new team DB.session.add(new_team) else: # Update team token team.token = token # Update DB DB.session.commit() return
def store_team(token, info): """Store a validated team in the database.""" # Check if team exists team = Teams.query.get(info['team_id']) if team is None: # Create new team new_team = Teams(info['team_id']) new_team.token = token # Store new team report_event('team_added', {'token': token, 'info': info}) DB.session.add(new_team) else: # Update team token report_event('team_updated', {'token': token, 'info': info}) team.token = token # Update DB DB.session.commit() return
def store_team(token, info): """Store a validated team in the database.""" # Check if team exists team = Teams.query.get(info["team_id"]) if team is None: # Create new team new_team = Teams(info["team_id"]) new_team.token = token # Store new team report_event("team_added", {"token": token, "info": info}) DB.session.add(new_team) else: # Update team token report_event("team_updated", {"token": token, "info": info}) team.token = token # Update DB DB.session.commit() return