Skip to content

Flatten all matching gamePk highlights across dates#172

Open
ty-porter wants to merge 2 commits into
toddrob99:developfrom
ty-porter:iss-164-doubleheader-highlights
Open

Flatten all matching gamePk highlights across dates#172
ty-porter wants to merge 2 commits into
toddrob99:developfrom
ty-porter:iss-164-doubleheader-highlights

Conversation

@ty-porter
Copy link
Copy Markdown

Addresses #164

gamePk is the unique ID for a game even across multiple dates, such as the example where a rainout moves the game to a later date. This causes the first game to have empty highlights, but the second has actual data.

This change allows game_highlight_data() to grab every highlight across multiple dates and flatten them into a single list.

@WardBrian WardBrian changed the base branch from master to develop June 2, 2026 01:31
Comment thread statsapi/__init__.py Outdated
.get("highlights", {})
)

gameHighlights = { "items": [] }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding these to a dictionary seems a bit silly, since they just get pulled out on line 1079. A list would do, and would simplify some of the following code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair, spent some time untangling the rest of the implementation. This should be cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants