Implement dynamic roster type detection in /trade add-player #29

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

Description

commands/transactions/trade.py:309-312 — When adding a player to a trade, code hardcodes from_roster = RosterType.MAJOR_LEAGUE and to_roster = RosterType.MAJOR_LEAGUE. Impossible to correctly trade a player from/to Minor League via the command.

File Locations

  • commands/transactions/trade.py:309-312

Labels

bug, enhancement, todo

Priority

medium

## Description `commands/transactions/trade.py:309-312` — When adding a player to a trade, code hardcodes `from_roster = RosterType.MAJOR_LEAGUE` and `to_roster = RosterType.MAJOR_LEAGUE`. Impossible to correctly trade a player from/to Minor League via the command. ## File Locations - `commands/transactions/trade.py:309-312` ## Labels bug, enhancement, todo ## Priority medium
cal added the
in-next-release
label 2026-03-02 20:24:17 +00:00
Author
Owner

Fixed in PR #56 (commit 58043c9), already merged to next-release. Both /trade add-player and /trade supplementary now auto-detect roster type via team_service.get_team()roster_type() instead of hardcoding MAJOR_LEAGUE. Will close when next-release merges to main.

Fixed in PR #56 (commit 58043c9), already merged to `next-release`. Both `/trade add-player` and `/trade supplementary` now auto-detect roster type via `team_service.get_team()` → `roster_type()` instead of hardcoding `MAJOR_LEAGUE`. Will close when `next-release` merges to `main`.
cal added the
ai-working
label 2026-03-03 06:05:29 +00:00
Author
Owner

Fixed in PR #61.

Approach: Replaced the hardcoded RosterType.MAJOR_LEAGUE defaults with dynamic detection:

  • from_roster: derived from player.team.roster_type(). If the search endpoint only returns a team_id (no nested team object), falls back to fetching the full team via team_service.get_team().
  • to_roster: derived from dest_team.roster_type(), which resolves via the team's abbreviation suffix (e.g. NYYMIL → Minor League, NYYIL → Injured List).

All 930 tests pass.

Fixed in PR #61. **Approach**: Replaced the hardcoded `RosterType.MAJOR_LEAGUE` defaults with dynamic detection: - `from_roster`: derived from `player.team.roster_type()`. If the search endpoint only returns a `team_id` (no nested team object), falls back to fetching the full team via `team_service.get_team()`. - `to_roster`: derived from `dest_team.roster_type()`, which resolves via the team's abbreviation suffix (e.g. `NYYMIL` → Minor League, `NYYIL` → Injured List). All 930 tests pass.
cal added
ai-pr-opened
and removed
ai-working
labels 2026-03-03 06:08:30 +00:00
cal closed this issue 2026-03-20 15:31:38 +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/major-domo-v2#29
No description provided.