mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Skip a landlord override that targets a building part the EPC lacks 🟩
A Landlord Override can reference a building part the lodged or predicted EPC never carried (e.g. an extension_1 override on a property whose EPC has only main). apply_simulations indexed parts_by_id[identifier] unguarded, raising KeyError and aborting the whole property's modelling. Now the orphaned part is skipped. Recovers 14 of the 22 modelling_e2e failures in portfolio 796. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d1a2ee11e8
commit
23ccfb0d0b
1 changed files with 7 additions and 1 deletions
|
|
@ -41,7 +41,13 @@ def apply_simulations(
|
|||
|
||||
for simulation in simulations:
|
||||
for identifier, overlay in simulation.building_parts.items():
|
||||
part = parts_by_id[identifier]
|
||||
# A Landlord Override can target a building part the lodged (or
|
||||
# predicted) EPC never carried — e.g. an `extension_1` override on a
|
||||
# property whose EPC has only `main`. Skip the orphaned part rather
|
||||
# than crashing the whole property's modelling on a `KeyError`.
|
||||
part = parts_by_id.get(identifier)
|
||||
if part is None:
|
||||
continue
|
||||
for overlay_field in fields(overlay):
|
||||
value = getattr(overlay, overlay_field.name)
|
||||
if value is not None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue