mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Two fixes so a multi-scenario export over a PasHub-fetched portfolio is correct: 1. Plan selection: take the NEWEST plan per (property, scenario), not the is_default one. is_default is one-per-property (not per-scenario), so it cannot scope a multi-scenario export — a property's default sits under a single scenario, leaving every other scenario with zero rows. _ROWS_SQL and _MEASURES_SQL now DISTINCT ON (property_id) ORDER BY created_at DESC, id DESC. 2. Effective-EPC descriptive block: match the header facts + current performance by UPRN (the latest epc_property for the source), because the PasHub re-fetch lands records with property_id = NULL — a property_id join silently fell back to a stale gov-EPC cert (wrong 2013-2025 lodgement dates / int property_type) or nothing. Lodgement date coalesces registration -> completion -> inspection (PasHub surveys carry only inspection_date). Descriptive prose elements stay on the property_id gov-EPC fallback (a survey lodges structured fields, not gov-EPC prose). Result on portfolio 838 / scenarios 1303+1304: both sheets populate 205 rows; property_type text on 204/205; lodgement dates 2026 on 200/205. Repository tests updated (uprn fixtures, newest-plan selection + a newest-wins case); 22 export tests pass, pyright clean. |
||
|---|---|---|
| .. | ||
| abri | ||
| applications | ||
| backend | ||
| datatypes | ||
| domain | ||
| e2e | ||
| fixtures | ||
| harness | ||
| infrastructure | ||
| lambdas | ||
| magic_plan | ||
| orchestration | ||
| repositories | ||
| scripts | ||
| utilities | ||
| utils | ||
| __init__.py | ||
| conftest.py | ||
| test_lambda_packaging.py | ||