From 0387f4a8977c9589db0a3c35df180c4189fce0e4 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 8 Jul 2026 09:45:13 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20a=20property's=20display=20address=20?= =?UTF-8?q?from=20its=20landlord=5Fproperty=5Fid=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- repositories/property/landlord_address_resolver.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/repositories/property/landlord_address_resolver.py b/repositories/property/landlord_address_resolver.py index 332f6b149..cf051c0bd 100644 --- a/repositories/property/landlord_address_resolver.py +++ b/repositories/property/landlord_address_resolver.py @@ -23,8 +23,15 @@ class LandlordAddressResolver: def __init__( self, session: Session, landlord_property_ids: Sequence[str] ) -> None: - self._session = session - self._ids = list(landlord_property_ids) + stmt = select(PropertyRow).where( + col(PropertyRow.landlord_property_id).in_(list(landlord_property_ids)) + ) + rows = session.execute(stmt).scalars().all() # pyright: ignore[reportDeprecated] + self._by_id: dict[str, str] = { + row.landlord_property_id: row.address + for row in rows + if row.landlord_property_id is not None and row.address is not None + } def address_for(self, landlord_property_id: str) -> str: - raise NotImplementedError + return self._by_id.get(landlord_property_id, self._FALLBACK)