**Avoid resolving away lineups by non-unique numbers** #75

Closed
opened 2026-06-03 11:15:12 +02:00 by umpire274 · 0 comments
umpire274 commented 2026-06-03 11:15:12 +02:00 (Migrated from github.com)

Avoid resolving away lineups by non-unique numbers

When is_home_team is false, this lookup now matches on away_number, but the schema only enforces UNIQUE(team_id, number) and the player create/edit/import paths allow duplicate away numbers. In that case the away roster display can show two players with the same jersey, this loop accepts the duplicate number, and the subsequent find always selects the first matching player while used_numbers prevents selecting the other, so a valid-looking away lineup cannot be entered correctly. Consider enforcing away-number uniqueness or selecting players by a unique roster index/id.

Useful? React with 👍 / 👎.

Originally posted by @chatgpt-codex-connector[bot] in https://github.com/umpire274/bs_scoring/pull/74#discussion_r3347271601

**Avoid resolving away lineups by non-unique numbers** When `is_home_team` is false, this lookup now matches on `away_number`, but the schema only enforces `UNIQUE(team_id, number)` and the player create/edit/import paths allow duplicate away numbers. In that case the away roster display can show two players with the same jersey, this loop accepts the duplicate number, and the subsequent `find` always selects the first matching player while `used_numbers` prevents selecting the other, so a valid-looking away lineup cannot be entered correctly. Consider enforcing away-number uniqueness or selecting players by a unique roster index/id. Useful? React with 👍 / 👎. _Originally posted by @chatgpt-codex-connector[bot] in https://github.com/umpire274/bs_scoring/pull/74#discussion_r3347271601_
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
umpire274/bs_scoring#75
No description provided.