mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
address fields are not optional
This commit is contained in:
parent
997cd0f1d3
commit
5aa86a8610
3 changed files with 8 additions and 8 deletions
|
|
@ -113,8 +113,8 @@ class PropertyModel(Base):
|
||||||
Enum(PortfolioStatus, values_callable=lambda x: [e.value for e in x]),
|
Enum(PortfolioStatus, values_callable=lambda x: [e.value for e in x]),
|
||||||
nullable=False,
|
nullable=False,
|
||||||
)
|
)
|
||||||
address = Column(Text)
|
address = Column(Text, nullable=False)
|
||||||
postcode = Column(Text)
|
postcode = Column(Text, nullable=False)
|
||||||
has_pre_condition_report = Column(Boolean)
|
has_pre_condition_report = Column(Boolean)
|
||||||
has_recommendations = Column(Boolean)
|
has_recommendations = Column(Boolean)
|
||||||
created_at = Column(
|
created_at = Column(
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,9 @@ class EpcPropertyData:
|
||||||
inspection_date: date
|
inspection_date: date
|
||||||
tenure: str # str in site notes; stringified int (e.g. "1") from API
|
tenure: str # str in site notes; stringified int (e.g. "1") from API
|
||||||
transaction_type: str # str in site notes; stringified int from API
|
transaction_type: str # str in site notes; stringified int from API
|
||||||
|
address_line_1: str
|
||||||
|
postcode: str
|
||||||
|
post_town: str
|
||||||
|
|
||||||
# Elements
|
# Elements
|
||||||
roofs: List[EnergyElement]
|
roofs: List[EnergyElement]
|
||||||
|
|
@ -292,9 +295,6 @@ class EpcPropertyData:
|
||||||
assessment_type: Optional[str] = None # not available from site notes
|
assessment_type: Optional[str] = None # not available from site notes
|
||||||
sap_version: Optional[float] = None # not available from site notes
|
sap_version: Optional[float] = None # not available from site notes
|
||||||
uprn: Optional[int] = None # not available from site notes
|
uprn: Optional[int] = None # not available from site notes
|
||||||
address_line_1: Optional[str] = None # not available from site notes
|
|
||||||
postcode: Optional[str] = None # not available from site notes
|
|
||||||
post_town: Optional[str] = None # not available from site notes
|
|
||||||
status: Optional[str] = None # not available from site notes
|
status: Optional[str] = None # not available from site notes
|
||||||
window: Optional[EnergyElement] = None # not available from site notes
|
window: Optional[EnergyElement] = None # not available from site notes
|
||||||
lighting: Optional[EnergyElement] = None # not available from site notes
|
lighting: Optional[EnergyElement] = None # not available from site notes
|
||||||
|
|
|
||||||
|
|
@ -85,11 +85,11 @@ class EpcPropertyDataMapper:
|
||||||
general = survey.general
|
general = survey.general
|
||||||
metadata = survey.inspection_metadata
|
metadata = survey.inspection_metadata
|
||||||
address_parts = [p.strip() for p in metadata.property_address.split(", ")]
|
address_parts = [p.strip() for p in metadata.property_address.split(", ")]
|
||||||
postcode = address_parts[-1] if len(address_parts) >= 1 else None
|
postcode = address_parts[-1] if address_parts else ""
|
||||||
post_town = (
|
post_town = (
|
||||||
address_parts[-3]
|
address_parts[-3]
|
||||||
if len(address_parts) >= 4
|
if len(address_parts) >= 4
|
||||||
else (address_parts[-2] if len(address_parts) >= 3 else None)
|
else (address_parts[-2] if len(address_parts) >= 3 else "")
|
||||||
)
|
)
|
||||||
address_line_1 = (
|
address_line_1 = (
|
||||||
", ".join(address_parts[:-3])
|
", ".join(address_parts[:-3])
|
||||||
|
|
@ -97,7 +97,7 @@ class EpcPropertyDataMapper:
|
||||||
else (
|
else (
|
||||||
", ".join(address_parts[:-2])
|
", ".join(address_parts[:-2])
|
||||||
if len(address_parts) >= 3
|
if len(address_parts) >= 3
|
||||||
else address_parts[0] if address_parts else None
|
else address_parts[0] if address_parts else ""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue