Skip to content

Stop a placeholder zero replacing the Powerball jackpot with $0 - #132

Merged
bgard68 merged 1 commit into
mainfrom
claude/fix-zero-jackpot
Aug 25, 2026
Merged

Stop a placeholder zero replacing the Powerball jackpot with $0#132
bgard68 merged 1 commit into
mainfrom
claude/fix-zero-jackpot

Conversation

@bgard68

@bgard68 bgard68 commented Aug 25, 2026

Copy link
Copy Markdown
Owner

The site shows "Estimated jackpot $0 / Cash value $0" for Powerball while Mega Millions renders correctly. The two use different sources, which is the clue.

The chain

NY Lottery publishes the next draw entry before its jackpot is announced, with zeros in it. Every check along the path used is not null — and zero is not null:

Step What happened
Feed filter d.EstimatedJackpot is not nullaccepted the zeroed entry
Ordering OrderByDescending(DrawTime)preferred it, being the newest
RefreshGame NextEstimatedJackpot is not nullpersisted the zero
Store the good value was overwritten with 0
UI formatJackpot(0)"$0", a truthy string, so the card renders it

The frontend is not at fault: formatJackpot(null) returns null and the block is hidden. A visible $0 proves the API served a real zero.

Mega Millions was unaffected because it reads megamillions.com, not the NY API.

The fix

No lottery jackpot is zero — Powerball's floor is $20 million — so a non-positive figure means "not announced yet", never a real amount. Treated as absent in two places:

  • NyLotteryJackpotFeed ignores zeroed entries, and prefers a draw carrying an announced figure — so a zeroed later draw no longer wins on recency.
  • RefreshGame won't persist a non-positive estimate, so no source can poison the store this way.

Skipping the save leaves the previous estimate standing, which is what the card should keep showing until the real number lands. That's the graceful degradation the codebase already aims for elsewhere.

Tests

Four, and the three that reproduce the bug were each verified to fail against the previous code:

  • NyLottery_ZeroJackpotOnTheNextDraw_IsNotAFigure — the exact live payload shape
  • NyLottery_PrefersAnAnnouncedDrawOverAZeroedLaterOne — ordering no longer picks the placeholder
  • AZeroJackpot_DoesNotOverwriteTheStoredEstimate — the good value survives
  • ARealJackpot_StillReplacesTheStoredEstimate — the control: the guard must not freeze the value

325 tests pass, dotnet build -warnaserror zero warnings.

After merging

The card will keep showing whatever was last stored. If the store already holds 0 from before this fix, the next successful refresh with a real figure overwrites it — or POST /internal/refresh forces it immediately once NY announces the Wednesday jackpot.

🤖 Generated with Claude Code

The site showed "Estimated jackpot $0 / Cash value $0" for Powerball while
Mega Millions rendered correctly - the two use different sources.

NY Lottery publishes the next draw entry before its jackpot is announced, with
zeros in it. Every check on the path used "is not null", and zero is not null:

  the feed's filter accepted the entry            (EstimatedJackpot is not null)
  ordering by draw time then PREFERRED it          (it is the newest entry)
  RefreshGame persisted it                         (NextEstimatedJackpot is not null)
  the store's good value was overwritten with 0
  formatJackpot(0) renders "$0", which is truthy, so the card shows it

No lottery jackpot is zero - Powerball's floor is $20 million - so a
non-positive figure means "not announced yet", never a real amount. Treated as
absent in two places:

- NyLotteryJackpotFeed ignores zeroed entries and prefers a draw that carries
  an announced figure, so a zeroed later draw no longer wins on recency
- RefreshGame will not persist a non-positive estimate, so no source can poison
  the store this way

Skipping the save leaves the previous estimate standing, which is what the card
should keep showing until the real number lands.

Four tests; the three that reproduce the bug were each verified to fail against
the previous code, and the fourth pins that a genuine new figure still replaces
the stored one. 325 tests pass.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AWkVh7cyAz1gWapBH1CY8n
@bgard68
bgard68 merged commit d0d8a76 into main Aug 25, 2026
9 checks passed
@bgard68
bgard68 deleted the claude/fix-zero-jackpot branch August 25, 2026 04:25
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