def __init__(self): self.players = pd.DataFrame(list(Player.select().dicts())) self.country = pd.DataFrame(list(Country.select().dicts())) self.league = pd.DataFrame(list(League.select().dicts())) self.team = pd.DataFrame(list(Team.select().dicts())) self.match = pd.DataFrame(list(Match.select().dicts())) self.player_attributes = pd.DataFrame( list(PlayerAttributes.select().dicts())) self.team_attributes = pd.DataFrame( list(TeamAttributes.select().dicts())) self.preprocess()
matchups = api.get_team_matchups(team.key, league) logger.info( "Fetching roster info for team %s in league %s (%s)...", team.name, league.name, league.season) rosters = api.get_team_rosters(team, matchups) num_matchups = len(matchups) while num_matchups < 16 and num_matchups <= league.current_week: num_matchups += 1 api.get_team_roster(team, num_matchups, is_postseason=True, league=league) # cleanup matchups that haven't run yet # This needs to also delete the MatchupRosterSlots # Matchup.delete().where(Matchup.team_a_points==0,Matchup.team_b_points==0).execute() for key, info in SUB_LEAGUES.items(): parent = League.get(League.key == key) child = League.get(League.key == info['sub_key']) child.merge_into(parent) parent.name = info['name'] parent.save() League.delete().where(League.key == info['sub_key']).execute() # This is done last to get rid of "--hidden--" manager names for league_id in MANAGER_SOURCE_LEAGUES: league = League.select().where(League.id == league_id)[0] teams = api.get_league_teams(league, manager_only=True) league.delete_instance()