claude-memory/graph/fixes/fix-removed-dead-roster-fields-from-csv-in-paper-dynasty-dat-62d0f7.md

72 lines
2.4 KiB
Markdown

---
id: 62d0f73d-8854-4c71-9001-60b38d438534
type: fix
title: "Fix: removed dead roster fields from CSV in paper-dynasty-database v1_cards_get_one"
tags: [paper-dynasty-database, python, fastapi, fix, csv, dead-code, cards]
importance: 0.5
confidence: 0.8
created: "2026-03-03T19:06:18.393440+00:00"
updated: "2026-03-03T20:36:36.631086+00:00"
relations:
- target: 61b618e7-6c6a-46be-9dec-b31b57cb19fe
type: RELATED_TO
direction: outgoing
strength: 0.82
edge_id: 06b45144-877b-4e26-bad5-b479fa53e6c0
- target: b1eb1655-e006-447d-a0cf-bba7a914b331
type: RELATED_TO
direction: outgoing
strength: 0.78
edge_id: b4aad7b7-3664-4ed7-887c-389cacc7d265
- target: 1e0e14cd-588f-417d-8fcb-a48a6cca506d
type: RELATED_TO
direction: outgoing
strength: 0.94
edge_id: 62b830d7-95b3-493e-bca7-04cdc6e56229
- target: 573491c4-cced-4400-8029-84d6298df631
type: RELATED_TO
direction: incoming
strength: 0.82
edge_id: 4f6cbe71-f2a1-4d28-8c54-66031407ee40
---
## 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:
```python
# 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_patch` endpoint still accepts `roster1_id`, `roster2_id`, `roster3_id` params 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: https://git.manticorum.com/cal/paper-dynasty-database/pulls/36
Issue #35