Skip to content

Expose underage on IPlayer - #67

Merged
yung-madamm merged 2 commits into
mainfrom
feat/player-underage
Sep 25, 2026
Merged

yung-madamm merged 2 commits into
mainfrom
feat/player-underage

Conversation

@yung-madamm

@yung-madamm yung-madamm commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What & why

The REST player profile carries underage since oddsfeedschema v1.1.0, with the same -1 unknown / 0 no / 1 yes encoding as competitors. This reads it and exposes it on IPlayer.

  • player_profilePlayer gets an underage XML attribute (string, as xsd.exe renders the competitor one).
  • New public UnderageStatus enum (Unknown = -1, No = 0, Yes = 1) in Oddin.OddsFeedSdk.API.Entities.Abstractions, and an internal UnderageStatusParser; anything unexpected, including null, maps to Unknown.
  • IPlayer.Underage / Player.Underage, backed by a single value on LocalizedPlayer (it is locale-independent). Unknown when the player cannot be loaded, matching how the other properties degrade.
  • Players nested in a competitor profile share player_profilePlayer and PlayerCache.RefreshOrInsertItem, so they carry it too.

ICompetitor.Underage stays a string; changing it would be a breaking API change.

Verification

PlayerUnderageTests: parser theory (1, 0, -1, null, empty, junk), LocalizedPlayer default, and XmlHelper.TryDeserialize of a profile with underage="1". dotnet build (Release) 0 errors and dotnet test 8/8 on the .NET 6 SDK image.

🤖 Generated with Claude Code

Review follow-up (second commit)

  • Omitted attribute no longer erases a known value. Confirmed against the code: HandlePlayersData feeds nested player_profilePlayer objects from every competitor profile response straight into RefreshOrInsertItem, and the culture is then marked loaded, so an unconditional assignment let a second-culture or nested payload without the attribute reset a known Yes/No to Unknown until the TTL. RefreshOrInsertItem now assigns only when data.underage is non-null; an explicit -1 still retracts.
  • Cache path is tested end to end. CacheCarriesUnderageThroughToThePlayerAndKeepsItWhenAPayloadOmitsIt side-loads a competitor profile through the existing PublishOnlyApiClientProxy harness, reads Player.Underage (Yes), publishes a second culture without the attribute (still Yes), then an explicit -1 (Unknown).

Verified again on the .NET 6 SDK image: build 0 errors, PlayerUnderageTests 9/9.

The player profile carries underage (-1 unknown / 0 no / 1 yes) since
oddsfeedschema v1.1.0. IPlayer.Underage returns it as the new
UnderageStatus enum; a missing attribute reads as Unknown.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yung-madamm yung-madamm self-assigned this Sep 25, 2026
Nested players are side-loaded from every competitor profile response,
so a later payload without the attribute (another culture, or a
producer that does not send it on nested players) reset a known
Yes/No to Unknown, and the culture was marked loaded so nothing
corrected it before the TTL. Assign only when the attribute is
present; an explicit -1 still retracts.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@yung-madamm
yung-madamm merged commit 66fcfca into main Sep 25, 2026
3 checks passed
@yung-madamm
yung-madamm deleted the feat/player-underage branch September 25, 2026 14:16
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