`Resource Name`, `Project Number (from Master)`, `Project Name (from Master)`, `Department (from Resource Name)` on Booking Resource are linked-record / lookup fields — Airtable always returns them as lists, even when cardinality is 1. The previous booking normaliser only handled one specific list case (`Resource Name (from Resource)`) and let the other field aliases pass through as raw lists. The merge service then crashed with `AttributeError: 'list' object has no attribute 'strip'` on first call to /api/utilisation/summary in prod. Introduce a `_flatten()` helper and apply it to every linked/lookup field in `normalise_booking`. Also make `_name_key` in the merge service defensive against raw lists so a missed flatten elsewhere degrades gracefully instead of 500ing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| auth | ||
| deps | ||
| models | ||
| routers | ||
| services | ||
| __init__.py | ||
| config.py | ||
| main.py | ||