Skip to content

feat(period-score): expose the games won inside a period - #64

Merged
dsaiko merged 1 commit into
developfrom
feat/period-score-games
Aug 21, 2026
Merged

dsaiko merged 1 commit into
developfrom
feat/period-score-games

Conversation

@dsaiko

@dsaiko dsaiko commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Why

Set-based classic sports report the games of each set on the period row, next to
the running sets-won tally. A live tennis match with the first set won 6:4 and
the second under way arrives from the feed as:

<sport_event_status status="1" match_status="201" scoreboard_available="true"
                    home_score="1" away_score="0">
  <period_score type="set" number="1" match_status_code="200"
                home_score="1" away_score="0" home_games="6" away_games="4"/>
  <period_score type="set" number="2" match_status_code="201"
                home_score="1" away_score="0" home_games="0" away_games="1"/>
  <scoreboard home_points="40" away_points="40" home_games="0" away_games="1"/>
</sport_event_status>

home_games / away_games had no place in the period score models — games
existed only on the scoreboard, which describes the set in progress and nothing
else. XmlSerializer therefore dropped the attribute while decoding, and a
consumer was left with home_score: the sets-won tally, identical on every row
(1:0, 1:0, …). Rendering a per-set row from it shows 1:0 where the set was 6:4.

It also cannot be reconstructed downstream. The scoreboard resets its games with
each new set, so once a set ends its score is gone from the live state, and a
consumer restarting mid-match has nothing to replay it from.

What changed

  • home_games / away_games on periodScoreType (feed) and periodScore
    (API), using the Specified pattern already used elsewhere in these models —
    XmlSerializer cannot encode nullable attributes (the reverted elapsed_time
    nullable fix hit exactly this), and the flag keeps absence distinguishable
    from a legitimate 0:0 at the start of a set
  • HomeGames / AwayGames as int? on IPeriodScore and the PeriodScore
    entity
  • mapped in both cache paths, feed and API (Specified ? value : null)
  • new Oddin.OddsFeedSdk.Tests project (xunit) — the repo had none; the CI
    "Run Library Tests" step was a placeholder pointing at the library project
    and now runs the test project instead

Additive only — no existing field changes shape or meaning.

Mirrors the same change in gosdk: oddin-gg/gosdk#48

Tests

PeriodScoreGamesTests deserializes the payload above through both decode
paths (odds_change and match_summary) and asserts a completed set keeps
6:4, the set in progress carries 0:1, a period without games leaves the
Specified flags unset (→ null on the entity), and the sets-won tally on the
same row stays readable and independent.

🤖 Generated with Claude Code

Set-based classic sports report the games of each set on the period row,
next to the running sets-won tally. home_games/away_games had no place in
the period score models, so XmlSerializer dropped the attribute while
decoding and consumers were left with the tally only - a per-set row
rendered 1:0 where the set was 6:4. The scoreboard cannot recover it
either: its games reset with every new set.

- home_games/away_games on periodScoreType (feed) and periodScore (API),
  using the Specified pattern so absence stays distinguishable from a
  real 0:0 (XmlSerializer cannot encode nullable attributes)
- HomeGames/AwayGames (int?) on IPeriodScore and the PeriodScore entity
- mapped in both cache paths, feed and API
- new Oddin.OddsFeedSdk.Tests project covering both decode paths; CI now
  runs it instead of the placeholder library test step

Additive only - no existing field changes shape or meaning.

Mirrors oddin-gg/gosdk#48

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dsaiko
dsaiko merged commit 9d9fe60 into develop Aug 21, 2026
3 checks passed
@dsaiko
dsaiko deleted the feat/period-score-games branch August 21, 2026 10:07
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