mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Postcode filter matches the canonical postcode exactly 🟩
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
b865e89195
commit
10b9015bce
1 changed files with 5 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue