fix: use correct column name (animal_id) in get_event_animals query

The animal_registry table uses animal_id as its primary key, not id.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-01 19:15:31 +00:00
parent 3937d675ba
commit a35d4a3c0d
4 changed files with 140 additions and 3 deletions

View File

@@ -121,12 +121,12 @@ def get_event_animals(db: Any, event_id: str) -> list[dict[str, Any]]:
"""
rows = db.execute(
"""
SELECT ar.id, ar.nickname, s.name as species_name
SELECT ar.animal_id, ar.nickname, s.name as species_name
FROM event_animals ea
JOIN animal_registry ar ON ar.id = ea.animal_id
JOIN animal_registry ar ON ar.animal_id = ea.animal_id
JOIN species s ON s.code = ar.species_code
WHERE ea.event_id = ?
ORDER BY ar.nickname NULLS LAST, ar.id
ORDER BY ar.nickname NULLS LAST, ar.animal_id
""",
(event_id,),
).fetchall()