2.4 KiB
2.4 KiB
| id | type | title | tags | importance | confidence | created | updated | relations | |||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 62d0f73d-8854-4c71-9001-60b38d438534 | fix | Fix: removed dead roster fields from CSV in paper-dynasty-database v1_cards_get_one |
|
0.5 | 0.8 | 2026-03-03T19:06:18.393440+00:00 | 2026-03-03T20:36:36.631086+00:00 |
|
Problem
v1_cards_get_one in app/routers_v2/cards.py had a CSV branch that referenced this_card.roster1.name, this_card.roster2.name, and this_card.roster3.name — none of which exist on the Card model. Any GET /api/v2/cards/{card_id}?csv=true request would raise AttributeError at runtime.
Root Cause
Dead fields left over from an older schema design; the Card model only has player, team, pack, value (plus id).
Solution
Removed the three non-existent roster columns from both the CSV header row and data row:
# Before
data_list = [
['id', 'player', 'team', 'pack', 'value', 'roster1', 'roster2', 'roster3'],
[..., this_card.roster1.name, this_card.roster2.name, this_card.roster3.name]
]
# After
data_list = [
['id', 'player', 'team', 'pack', 'value'],
[this_card.id, this_card.player, this_card.team.abbrev, this_card.pack, this_card.value]
]
Files Changed
app/routers_v2/cards.py— lines ~144-146
Notes
- The
v1_cards_patchendpoint still acceptsroster1_id,roster2_id,roster3_idparams that are silently ignored — dead API surface, tracked separately. - Project has a ruff linter hook that auto-reformats files on edit (single→double quotes, line wrapping). The functional diff was just the roster field removal.
PR
PR #36: cal/paper-dynasty-database#36 Issue #35