Standardize home-run detection to use _on_final fields only #22

Closed
opened 2026-02-20 06:51:06 +00:00 by cal · 2 comments
Owner

db_calls_gameplay.py:1289 notes # patch to handle little league home runs TODO: standardize on just _on_final for these. Two-path handling introduces potential scoring inconsistency.

`db_calls_gameplay.py:1289` notes `# patch to handle little league home runs TODO: standardize on just _on_final for these`. Two-path handling introduces potential scoring inconsistency.
cal added the
tech-debt
todo
labels 2026-02-20 06:51:06 +00:00
cal added the
ai-working
label 2026-03-05 18:31:23 +00:00
cal added
ai-pr-opened
and removed
ai-working
labels 2026-03-05 18:36:42 +00:00
Author
Owner

Fixed in PR #68: #68

Approach: Before the HR detection check in complete_play(), set this_play.batter_final = batter_to_base when batter_to_base is provided. This makes batter_final (an _on_final field) the authoritative source, so the check simplifies from batter_final == 4 or batter_to_base == 4 to just batter_final == 4. The TODO comment is also removed.

Fixed in PR #68: https://git.manticorum.com/cal/paper-dynasty-discord/pulls/68 **Approach:** Before the HR detection check in `complete_play()`, set `this_play.batter_final = batter_to_base` when `batter_to_base` is provided. This makes `batter_final` (an `_on_final` field) the authoritative source, so the check simplifies from `batter_final == 4 or batter_to_base == 4` to just `batter_final == 4`. The TODO comment is also removed.
Author
Owner

Fixed in PR #106. In complete_play() in db_calls_gameplay.py, batter_final is now set to batter_to_base when it is not None before the HR check, so only this_play.batter_final == 4 needs to be tested. The redundant or batter_to_base == 4 path and the patch comment are removed.

Fixed in PR #106. In `complete_play()` in `db_calls_gameplay.py`, `batter_final` is now set to `batter_to_base` when it is not None before the HR check, so only `this_play.batter_final == 4` needs to be tested. The redundant `or batter_to_base == 4` path and the patch comment are removed.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#22
No description provided.