store: Fix: Remove dead roster fields from CSV in paper-dynasty-database v1_cards_get_one
This commit is contained in:
parent
2ccb77f04d
commit
61736f7834
@ -0,0 +1,47 @@
|
||||
---
|
||||
id: 573491c4-cced-4400-8029-84d6298df631
|
||||
type: fix
|
||||
title: "Fix: Remove dead roster fields from CSV in paper-dynasty-database v1_cards_get_one"
|
||||
tags: [paper-dynasty-database, fastapi, python, fix, dead-code, csv, peewee]
|
||||
importance: 0.5
|
||||
confidence: 0.8
|
||||
created: "2026-03-03T20:36:36.060493+00:00"
|
||||
updated: "2026-03-03T20:36:36.060493+00:00"
|
||||
---
|
||||
|
||||
## Problem
|
||||
|
||||
`v1_cards_get_one` in `app/routers_v2/cards.py` included `roster1`, `roster2`, `roster3` in the CSV output. Accessing `this_card.roster1.name` etc. raises `AttributeError` at runtime because the `Card` model has no roster fields.
|
||||
|
||||
## Root Cause
|
||||
|
||||
Dead code referencing non-existent model fields. The `Card` model only has `player`, `team`, `pack`, `value` fields.
|
||||
|
||||
## Fix
|
||||
|
||||
Removed the three roster columns from both the CSV header list and the data row.
|
||||
|
||||
**Before:**
|
||||
```python
|
||||
data_list = [
|
||||
['id', 'player', 'team', 'pack', 'value', 'roster1', 'roster2', 'roster3'],
|
||||
[..., this_card.roster1.name, this_card.roster2.name, this_card.roster3.name]
|
||||
]
|
||||
```
|
||||
|
||||
**After:**
|
||||
```python
|
||||
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`
|
||||
|
||||
## Notes
|
||||
|
||||
- Ruff linter hook auto-reformats the entire file on save (single → double quotes, line wrapping) — large diff but small functional change.
|
||||
- `v1_cards_patch` still accepts `roster1_id`/`roster2_id`/`roster3_id` params that are silently ignored — dead API surface for a separate cleanup.
|
||||
Loading…
Reference in New Issue
Block a user