Guard against None rating objects in pitcher sorting functions #13

Closed
opened 2026-02-20 06:52:17 +00:00 by cal · 1 comment
Owner

`app/routers_v2/teams.py:600-615` and `679-694`. `get_total_ops` calls `vlval.obp` directly after `get_or_none()`. If rating row doesn't exist, AttributeError produces a 500 response. DH-finding path correctly catches this but pitcher paths don't.

Priority: high

\`app/routers_v2/teams.py:600-615\` and \`679-694\`. \`get_total_ops\` calls \`vlval.obp\` directly after \`get_or_none()\`. If rating row doesn't exist, AttributeError produces a 500 response. DH-finding path correctly catches this but pitcher paths don't. **Priority**: high
cal added the
bug
label 2026-02-20 06:52:17 +00:00
cal added the
ai-working
label 2026-03-04 02:01:13 +00:00
cal removed the
ai-working
label 2026-03-04 02:04:23 +00:00
Author
Owner

Fixed in PR #50: #50

Added None checks for vlval/vrval in both get_total_ops closures (sort_pitchers and the inner sort_starters). When either rating row is missing, the function returns float("inf") so the pitcher sorts to the end of the list rather than raising an AttributeError and producing a 500 response.

Fixed in PR #50: https://git.manticorum.com/cal/paper-dynasty-database/pulls/50 Added `None` checks for `vlval`/`vrval` in both `get_total_ops` closures (`sort_pitchers` and the inner `sort_starters`). When either rating row is missing, the function returns `float("inf")` so the pitcher sorts to the end of the list rather than raising an `AttributeError` and producing a 500 response.
cal added the
ai-pr-opened
label 2026-03-04 02:04:33 +00:00
cal closed this issue 2026-03-05 03:29:49 +00:00
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-database#13
No description provided.