Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MyFantasyLeague for playoff weeks #117

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion leeger/league_loader/MyFantasyLeagueLeagueLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ def __buildWeeks(self, mflLeague: dict) -> list[Week]:
playoffsStarted = True
# get each teams matchup for that week
matchups = list()
for matchup in week["matchup"]:
# skip weeks with no matchup. get() is a safe method that doesn't throw an error if the element is missing.
local_matchups = week.get("matchup", {})
if not local_matchups:
break
# Make sure that localMatchups is a list (some weeks just have a json element)
if not (isinstance(local_matchups, list)):
local_matchups = [local_matchups]
for matchup in local_matchups:
teamAMFLFranchiseId = matchup["franchise"][0]["id"]
teamAId = self.__mflFranchiseIdToTeamMap[teamAMFLFranchiseId].id
teamAScore = float(matchup["franchise"][0]["score"])
Expand Down
Loading