Compare commits

...

2 commits

Author SHA1 Message Date
Carlos 2e3486c3f1 Prettify the header names 2024-09-26 00:11:59 -07:00
Carlos 8877ebee47 Removing duplicate logic for week override 2024-09-26 00:04:32 -07:00

23
app.py
View file

@ -23,22 +23,19 @@ def extract_positional_data(lineup: list, position: str) -> int:
return response return response
def extract_matchup_box_scores(league: League, week_override: int = None) -> dict: def extract_matchup_box_scores(league: League, week_override: int) -> dict:
week_to_process = league.current_week matchups = league.box_scores(week=week_override)
if week_override:
week_to_process = week_override
matchups = league.box_scores(week=week_to_process)
result = [] result = []
for matchup in matchups: for matchup in matchups:
result.append({ result.append({
'away_team': matchup.away_team.team_name, 'Away Team': matchup.away_team.team_name,
'away_score': matchup.away_score, 'Away Team Score': matchup.away_score,
'away_team_kicker_score': extract_positional_data(matchup.away_lineup, 'K'), 'Away Team Kicker Score': extract_positional_data(matchup.away_lineup, 'K'),
'away_team_bench_score': extract_positional_data(matchup.away_lineup, 'BE'), 'Away Team Bench Score': extract_positional_data(matchup.away_lineup, 'BE'),
'home_team': matchup.home_team.team_name, 'Home Team': matchup.home_team.team_name,
'home_team_score': matchup.home_score, 'Home Team Score': matchup.home_score,
'home_team_kicker_score': extract_positional_data(matchup.home_lineup, 'K'), 'Home Team Kicker Score': extract_positional_data(matchup.home_lineup, 'K'),
'home_team_bench_score': extract_positional_data(matchup.home_lineup, 'BE') 'Home Team Bench Score': extract_positional_data(matchup.home_lineup, 'BE')
}) })
return result return result