diff --git a/ff_espn_api/league.py b/ff_espn_api/league.py index 9810d5b8..c31908be 100644 --- a/ff_espn_api/league.py +++ b/ff_espn_api/league.py @@ -349,6 +349,8 @@ def scoreboard(self, week: int = None) -> List[Matchup]: for team in self.teams: for matchup in matchups: + if matchup.winner == team.team_id: + matchup.winner = team if matchup.home_team == team.team_id: matchup.home_team = team elif matchup.away_team == team.team_id: diff --git a/ff_espn_api/matchup.py b/ff_espn_api/matchup.py index 7fedbeb4..74395ffb 100644 --- a/ff_espn_api/matchup.py +++ b/ff_espn_api/matchup.py @@ -1,3 +1,6 @@ +WINNERS_BRACKET = 'WINNERS_BRACKET' + + class Matchup(object): '''Creates Matchup instance''' def __init__(self, data): @@ -7,6 +10,9 @@ def __init__(self, data): def __repr__(self): return 'Matchup(%s, %s)' % (self.home_team, self.away_team, ) + def is_playoff(self): + return WINNERS_BRACKET == self.playoff_tier_type + def _fetch_matchup_info(self): '''Fetch info for matchup''' self.home_team = self.data['home']['teamId'] @@ -18,3 +24,5 @@ def _fetch_matchup_info(self): if 'away' in self.data: self.away_team = self.data['away']['teamId'] self.away_score = self.data['away']['totalPoints'] + self.playoff_tier_type = self.data.get('playoffTierType', 'regular') + self.winner = self.home_team if self.data['winner'] == 'HOME' else self.away_team