store: Fix: removed dead roster fields from CSV in paper-dynasty-database v1_cards_get_one
This commit is contained in:
parent
29755fe156
commit
82b06f7f37
@ -0,0 +1,50 @@
|
||||
---
|
||||
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-03T19:06:18.393440+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:
|
||||
|
||||
```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
|
||||
Loading…
Reference in New Issue
Block a user