mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-27 23:35:01 +00:00
Complete the tenant sync without contacts when the property is void 🟩
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a3e1174d0d
commit
1bb45e2f4e
1 changed files with 20 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ from domain.abri.models import (
|
|||
AppointmentAmended,
|
||||
JobAbandoned,
|
||||
LogJobRequest,
|
||||
NoTenancyFound,
|
||||
PlaceRef,
|
||||
Tenant,
|
||||
)
|
||||
|
|
@ -24,6 +25,11 @@ from infrastructure.hubspot.errors import HubspotRequestError
|
|||
# property ID is fixed externally, the domain and database call it job_no.
|
||||
JOB_NO_DEAL_PROPERTY = "client_booking_reference"
|
||||
|
||||
# The note left on a deal whose place Abri reports as having no live tenancy.
|
||||
# Worded as what Abri said rather than as a conclusion about the property: the
|
||||
# same signal would arrive for a place_ref the deal should never have carried.
|
||||
VOID_PROPERTY_NOTE = "Abri reports no live tenancy for this property."
|
||||
|
||||
|
||||
def _vulnerability_description(tenant: Tenant) -> Optional[str]:
|
||||
"""The tenant's distinct vulnerabilities, verbatim and newline-joined.
|
||||
|
|
@ -259,6 +265,10 @@ class AbriOrchestrator:
|
|||
if isinstance(tenancy, AbriRequestRejected):
|
||||
return tenancy
|
||||
|
||||
if isinstance(tenancy, NoTenancyFound):
|
||||
self._note_property_void(deal_id=deal_id, place_ref=place_ref)
|
||||
return PropertyReportedVoid(place_ref=place_ref)
|
||||
|
||||
contact_ids: List[str] = []
|
||||
associated_ids: List[str] = []
|
||||
for tenant_index, tenant in enumerate(tenancy.tenants):
|
||||
|
|
@ -290,6 +300,16 @@ class AbriOrchestrator:
|
|||
),
|
||||
)
|
||||
|
||||
def _note_property_void(self, deal_id: str, place_ref: PlaceRef) -> None:
|
||||
"""Record the void property in the deal's extra booking information.
|
||||
|
||||
Deliberately unimplemented: the extra-booking-information property is
|
||||
not yet scraped onto the deal, so there is nothing to append to. The
|
||||
write lands in the follow-up that adds the property; until then the
|
||||
flow completes so a void property never dead-letters. Filling this in
|
||||
is a single write_deal_property call with VOID_PROPERTY_NOTE.
|
||||
"""
|
||||
|
||||
def amend_job(self, change: AppointmentChange) -> AmendJobOrchestrationResult:
|
||||
job_no = self._deal_database.job_no_for_deal(change.deal_id)
|
||||
if job_no is None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue