Postcode filter matches the canonical postcode exactly 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-07 11:34:07 +00:00
parent b865e89195
commit 10b9015bce

View file

@ -43,14 +43,17 @@ def resolve_filtered_property_ids(
portfolio's rows with ``marked_for_deletion = false``; property_type /
built_form resolve override lodged EPC predicted EPC legacy columns
"Unknown"."""
rows = session.exec(
statement = (
select(PropertyRow)
.where(PropertyRow.portfolio_id == portfolio_id)
# IS NOT TRUE rather than == False: the FE schema defaults the flag,
# but a NULL must never silently exclude a property.
.where(col(PropertyRow.marked_for_deletion).isnot(True))
.order_by(col(PropertyRow.id))
).all()
)
if filters.postcodes is not None:
statement = statement.where(col(PropertyRow.postcode).in_(filters.postcodes))
rows = session.exec(statement).all()
return [
FilteredProperty(property_id=row.id, postcode=row.postcode)
for row in rows