Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev -> staging #392

Merged
merged 24 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
07174ab
PC-1383: add html for no epc page
samyou-softwire Oct 23, 2024
29dffe8
PC-1383: add no epc page to route
samyou-softwire Oct 23, 2024
2077a56
PC-1383: format migration
samyou-softwire Oct 24, 2024
6ececb6
PC-1383: fix & add tests
samyou-softwire Oct 24, 2024
a7cdef4
PC-1383: add translations for no epc page
samyou-softwire Oct 24, 2024
7c53c8e
PC-1380: remove EPC warning dropdown on address select
samyou-softwire Oct 24, 2024
d5bbe69
Merge pull request #380 from UKGovernmentBEIS/PC-1383-add-epc-not-fou…
samyou-softwire Oct 31, 2024
6b9d3be
PC-1342: add text to epc page for scottish routes
samyou-softwire Oct 25, 2024
b95c641
PC-1342: add translations
samyou-softwire Oct 28, 2024
6bed47d
Merge pull request #382 from UKGovernmentBEIS/PC-1342-show-epc-outdat…
samyou-softwire Oct 31, 2024
6f7782e
PC-1349: add "property type" to EPC page
Glenn-Clarke Oct 24, 2024
5b01ab1
PC-1349: standardise keys to avoid capitalisation mistakes
Glenn-Clarke Oct 24, 2024
639a059
PC-1349: change fallback value to None from empty string
Glenn-Clarke Oct 24, 2024
0ba7bf9
PC-1349: fallback to the literal string always in english
samyou-softwire Oct 30, 2024
3d72b04
PC-1349: add tests for epc values
samyou-softwire Oct 30, 2024
ebb8c9b
Merge pull request #379 from UKGovernmentBEIS/PC-1349-add-property-ty…
samyou-softwire Oct 31, 2024
cf0bdac
PC-1415: use --check flags on pipeline
samyou-softwire Oct 31, 2024
d1cd675
PC-1415: refactor code inspection tasks to a common parent
samyou-softwire Oct 31, 2024
11348ee
Merge pull request #390 from UKGovernmentBEIS/PC-1415-fix-for-pipelin…
samyou-softwire Nov 1, 2024
5e671fb
PC-1349: add a guard for if property type is not found
samyou-softwire Nov 1, 2024
8c52d3f
Merge pull request #391 from UKGovernmentBEIS/PC-1349-fix-for-none-ep…
samyou-softwire Nov 1, 2024
7c6d366
PC-1374: add new epc data to session
samyou-softwire Oct 28, 2024
9882a18
PC-1374: expose recommendations from scottish epcs in export csv
samyou-softwire Oct 28, 2024
e45ac68
Merge pull request #383 from UKGovernmentBEIS/PC-1374-link-new-scotti…
samyou-softwire Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ add-suppliers:

# -------------------------------------- Code Style -------------------------------------

.PHONY: format-python-code
format-python-code:
docker compose -f tests/docker-compose.yml build format-code-help-to-heat && docker compose -f tests/docker-compose.yml run --no-deps --rm format-code-help-to-heat

.PHONY: check-python-code
check-python-code:
docker compose -f tests/docker-compose.yml build check-code-help-to-heat && docker compose -f tests/docker-compose.yml run --no-deps --rm check-code-help-to-heat
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Migrations are run automatically at startup, and suppliers are added automatical

## Checking code

make check-python-code
make format-python-code

## Deployment

Expand Down
13 changes: 9 additions & 4 deletions docker/tests/check-code.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#!/bin/sh
#!/bin/bash

set -o errexit
set -o nounset

black .
isort .
if [[ $1 = "--format" ]]; then
black .
isort .
else
black --check --diff .
isort --check --diff .
fi

flake8 .
4 changes: 4 additions & 0 deletions help_to_heat/frontdoor/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
address_select_manual_page = "address-select-manual"
council_tax_band_page = "council-tax-band"
epc_page = "epc"
no_epc_page = "no-epc"
epc_ineligible_page = "epc-ineligible"
benefits_page = "benefits"
household_income_page = "household-income"
Expand Down Expand Up @@ -58,6 +59,7 @@
address_select_manual_page,
council_tax_band_page,
epc_page,
no_epc_page,
epc_ineligible_page,
benefits_page,
household_income_page,
Expand Down Expand Up @@ -205,6 +207,8 @@
epc_rating_field_not_found = "Not found"
epc_rating_is_eligible_field = "epc_rating_is_eligible"

no_epc_field = "confirm_no_epc"

benefits_field = "benefits"

household_income_field = "household_income"
Expand Down
64 changes: 62 additions & 2 deletions help_to_heat/frontdoor/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,14 +525,74 @@ def parse_dpa_to_address(self, dpa):


class EPC(Entity):
@with_schema(load=GetScottishEPCSchema, dump=EPCSchema)
@with_schema(load=GetScottishEPCSchema)
def get_epc_scotland(self, uprn):
try:
epc = portal.models.ScottishEpcRating.objects.get(uprn=uprn)
except portal.models.ScottishEpcRating.DoesNotExist:
return {}

return {"uprn": epc.uprn, "rating": epc.rating, "date": epc.date}
improvements = epc.improvements
alternative_improvements = epc.alternative_improvements
all_improvements = improvements + (
"|| Alternatives: " + alternative_improvements if alternative_improvements else ""
)

return {
# follows column names in help_to_heat/frontdoor/mock_epc_api_data/sample_epc_response.json
"uprn": epc.uprn,
"current-energy-rating": epc.rating,
"lodgement-date": epc.date,
"property-type": epc.property_type,
"address1": epc.address1,
"address2": epc.address2,
"address3": epc.address3,
"postcode": epc.postcode,
"building-reference-number": epc.building_reference_number,
"potential-energy-rating": epc.potential_rating,
"current-energy-efficiency": epc.current_energy_efficiency_rating,
"potential-energy-efficiency": epc.potential_energy_efficiency_rating,
"built-form": epc.built_form,
"inspection-date": epc.inspection_date,
"local-authority-label": epc.local_authority,
"constituency-label": epc.constituency,
"energy-consumption-current": epc.energy_consumption,
"energy-consumption-potential": epc.potential_energy_consumption,
"co2-emissions-current": epc.co2_emissions,
"co2-emiss-curr-per-floor-area": epc.co2_emissions_per_floor_area,
"co2-emissions-potential": epc.co2_emissions_potential,
"total-floor-area": epc.floor_area,
"floor-level": epc.floor_level,
"floor-height": epc.floor_height,
"energy-tariff": epc.energy_tariff,
"mains-gas-flag": epc.mains_gas,
"multi-glaze-proportion": epc.multiple_glazed_proportion,
"extension-count": epc.extension_count,
"number-habitable-rooms": epc.habitable_room_count,
"number-heated-rooms": epc.heated_room_count,
"floor-description": epc.floor_description,
"floor-energy-eff": epc.floor_energy_efficiency,
"windows-description": epc.windows_description,
"walls-description": epc.wall_description,
"walls-energy-eff": epc.wall_energy_efficiency,
"walls-env-eff": epc.wall_environmental_efficiency,
"mainheat-description": epc.main_heating_description,
"mainheat-energy-eff": epc.main_heating_energy_efficiency,
"mainheat-env-eff": epc.main_heating_environmental_efficiency,
"main-fuel": epc.main_heating_fuel_type,
"secondheat-description": epc.second_heating_description,
"sheating-energy-eff": epc.second_heating_energy_efficiency,
"roof-description": epc.roof_description,
"roof-energy-eff": epc.roof_energy_efficiency,
"roof-env-eff": epc.roof_environmental_efficiency,
"lighting-description": epc.lighting_description,
"lighting-energy-eff": epc.lighting_energy_efficiency,
"lighting-env-eff": epc.lighting_environmental_efficiency,
"mechanical-ventilation": epc.mechanical_ventilation,
"construction-age-band": epc.construction_age_band,
"tenure": epc.tenure,
"improvements": all_improvements,
}

def get_address_and_epc_lmk(self, building_name_or_number, postcode):
epc_api = EPCApi()
Expand Down
12 changes: 4 additions & 8 deletions help_to_heat/frontdoor/mock_epc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@ def get_epc_recommendations(self, lmk_key):
return load_test_reponse("sample_epc_recommendations_response.json")


class MockEPCApiWithEPCC:
def search_epc_details(self, building, postcode):
return load_test_reponse("sample_search_response.json")

class MockEPCApiWithEPCC(MockEPCApi):
def get_epc_details(self, rrn):
return load_test_reponse("sample_epc_response_with_epc_c.json")

def get_epc_recommendations(self, lmk_key):
return load_test_reponse("sample_epc_recommendations_response.json")
epc = load_test_reponse("sample_epc_response.json")
epc["rows"][0]["current-energy-rating"] = "C"
return epc


class MockUnauthorizedEPCApi(MockEPCApi):
Expand Down

This file was deleted.

Loading
Loading