Enhanced football substitutions - #29027
Open
Jakeii wants to merge 6 commits into
Open
Conversation
Co-authored-by: William Mead <285652121+williammead@users.noreply.github.com>
Contributor
Jakeii
commented
Aug 6, 2026
| teamColour: String, | ||
| ): TeamStats = { | ||
| val players = makePlayers(teamV2) | ||
| val substitutions: Seq[Substitution] = players |
Member
Author
There was a problem hiding this comment.
This is where we gather the substitution events from the substitute players, so we can look up in DCR when we come across a player that was subbed out, what player was subbed in.
Jakeii
marked this pull request as ready for review
August 6, 2026 14:27
marjisound
reviewed
Aug 10, 2026
marjisound
left a comment
Contributor
There was a problem hiding this comment.
Looks great, just left 2 small comments/questions :)
| @@ -18,6 +21,7 @@ case class Player( | |||
| timeOnPitch: String, | |||
| shirtNumber: String, | |||
| events: Seq[PlayerEvent], | |||
Contributor
There was a problem hiding this comment.
Are we going to still have events? And also enhancedEvents? Can we not delete the events from here?
Member
Author
There was a problem hiding this comment.
If we remove it straight away, I think it'll make DCR's parser fail? once DCR is updated we can remove it
| def makePlayers(team: LineUpTeam): Seq[Player] = { | ||
| def makePlayers(team: LineUpTeamEnhanced): Seq[Player] = { | ||
| team.players.map { player => | ||
| val events = player.events.filter(event => MatchStats.reportedEventTypes.contains(event.eventType)).map { event => |
Contributor
There was a problem hiding this comment.
Same as above comment, can this be deleted or there's a reason we need to keep it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Use the new
LineUpsEnhancedAPI introduced in guardian/pa-football-client#125 to work out which player was substituted.The new API comes with an
eventIdwhich we can use to find the corresponding player that was substituted in and display it in the UI (see DCR PR)We use this to create a
substitutionslist on theTeamStats, which is used in DCR to lookup the player name that was substituted in.We've added
enhancedEventsin addition toeventson the players so this won't break DCR's parsing.Why
At the moment we know a substitution happened and at what time, but not who was substituted in!
Checklist
data/databasefiles generated by tests are committed with this PR (the tests will fail in CI if you've forgotten to do this)