mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Merge pull request #1586 from Hestia-Homes/feat/pashub-heating-efficiency-1563
PAS Hub mapper: boiler PCDB product_id → main_heating_index_number (#1563)
This commit is contained in:
commit
6be73555c6
2 changed files with 35 additions and 0 deletions
|
|
@ -6093,6 +6093,11 @@ def _map_sap_heating(
|
|||
condensing=main.condensing,
|
||||
weather_compensator=main.weather_compensator,
|
||||
central_heating_pump_age_str=main.central_heating_pump_age,
|
||||
# PCDB product id → the appliance's SEDBUK efficiency source
|
||||
# (`gas_oil_boiler_record`); 0 means no product lodged (#1563).
|
||||
main_heating_index_number=(
|
||||
main.product_id if main.product_id > 0 else None
|
||||
),
|
||||
)
|
||||
],
|
||||
has_fixed_air_conditioning=ventilation.has_fixed_air_conditioning,
|
||||
|
|
|
|||
|
|
@ -314,6 +314,35 @@ class TestWaterHeatingCoding:
|
|||
)
|
||||
|
||||
|
||||
class TestMainHeatingEfficiencySource:
|
||||
"""`from_site_notes` must carry the surveyed PCDB `product_id` onto
|
||||
`main_heating_index_number`, so the calculator reads the actual appliance's
|
||||
SEDBUK efficiency (`gas_oil_boiler_record`) instead of a generic Table-4b
|
||||
default. The site note lodges the boiler by PCDB id (`summer_efficiency` is
|
||||
always 0), so the index IS the efficiency source (issue #1563).
|
||||
"""
|
||||
|
||||
def _survey(self, **main: object) -> PasHubRdSapSiteNotes:
|
||||
data = load("pashub_rdsap_site_notes_example1.json")
|
||||
data["heating_and_hot_water"]["main_heating"].update(main)
|
||||
return from_dict(PasHubRdSapSiteNotes, data)
|
||||
|
||||
def test_product_id_maps_to_index_number(self) -> None:
|
||||
result = EpcPropertyDataMapper.from_site_notes(self._survey(product_id=18400))
|
||||
assert (
|
||||
result.sap_heating.main_heating_details[0].main_heating_index_number
|
||||
== 18400
|
||||
)
|
||||
|
||||
def test_zero_product_id_leaves_index_none(self) -> None:
|
||||
# No PCDB product lodged (e.g. selected by efficiency) → no index.
|
||||
result = EpcPropertyDataMapper.from_site_notes(self._survey(product_id=0))
|
||||
assert (
|
||||
result.sap_heating.main_heating_details[0].main_heating_index_number
|
||||
is None
|
||||
)
|
||||
|
||||
|
||||
class TestFromSiteNotesExample1:
|
||||
"""
|
||||
Fixture: pashub_rdsap_site_notes_example1.json
|
||||
|
|
@ -666,6 +695,7 @@ class TestFromSiteNotesExample1:
|
|||
condensing=True,
|
||||
weather_compensator=False,
|
||||
central_heating_pump_age_str="Unknown",
|
||||
main_heating_index_number=18400, # PCDB product id → efficiency source
|
||||
)
|
||||
],
|
||||
has_fixed_air_conditioning=False,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue