64 lines
2.0 KiB
Markdown
64 lines
2.0 KiB
Markdown
---
|
|
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.695912+00:00"
|
|
relations:
|
|
- target: 62d0f73d-8854-4c71-9001-60b38d438534
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.82
|
|
edge_id: 4f6cbe71-f2a1-4d28-8c54-66031407ee40
|
|
- target: 0fdd32ea-6b6a-4cd0-aa4b-117184e0c81d
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.87
|
|
edge_id: bd40401a-c8ac-49f7-9b5e-bbb880b0ae50
|
|
- target: b9375a89-6e0f-4722-bca7-f1cd655de81a
|
|
type: RELATED_TO
|
|
direction: outgoing
|
|
strength: 0.87
|
|
edge_id: 72bc9a13-dd0d-43ba-baff-5c5071a56a88
|
|
---
|
|
|
|
## 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.
|