def mutate(parent, info, tournament_id, matchups): existing_rounds = SQLTournament.get_all_rounds(tournament_id) current_round = len(existing_rounds) + 1 for matchup in matchups: SQLMatchup.add_matchup( tournament_id, round_num=current_round, pl=matchup["pl"], defense=matchup["defense"], ) return Round(round_num=current_round, tournament_id=tournament_id)
def resolve_rounds(parent, info): rounds = SQLTournament.get_all_rounds(parent.id) return [ Round(round_num=round_num, tournament_id=parent.id) for round_num in rounds ]