Repository navigation
Compute run rate from balls, not from the overs figure - #94
Open
dhairyapathak2005-cmyk wants to merge 1 commit into
Open
dhairyapathak2005-cmyk wants to merge 1 commit into
dhairyapathak2005-cmyk wants to merge 1 commit into
Conversation
ESPN writes overs in cricket notation: 19.4 is 19 overs and 4 balls. The innings run rate divided runs by that figure, so any innings that ended mid-over (a completed chase, a side bowled out) got too high a rate: 159 off 19.4 overs came out at 8.2 instead of 8.08. Divide by the balls bowled instead. ESPN's innings record carries `balls` and `ballsPerOver`; when `balls` is missing, convert the overs figure. The recorded fixture shows the notation: its partnerships pair overs 13.4 with balls 82. Innings of whole overs are unchanged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011R2whb7Ajr1ogzUchRBNVy
This branch has not been deployed
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
Match.team_1_run_rate,Match.team_2_run_rateand each innings'run_rateare too high for any innings that ends mid-over (a completed chase, a side bowled out).Why
ESPN writes overs in cricket notation: 19.4 is 19 overs and 4 balls.
_normalizedivided runs by that figure, so 159 off 19.4 overs came out at 8.2 an over instead of 8.08. The recorded fixture shows the notation: its partnerships pairovers: 13.4withballs: 82.Change
_run_ratehelper divides by balls bowled, using ESPN'sballsandballsPerOver. Whenballsis missing it converts the overs figure.Testing
uv run pytest(153 passed, 18 live tests skipped),ruff check,ruff format --checkandpyrightare clean. I did not run the--livetests, so this is not checked against a live match page.🤖 Generated with Claude Code
https://claude.ai/code/session_011R2whb7Ajr1ogzUchRBNVy