fix zoopla bug
This commit is contained in:
parent
96dfdd7491
commit
1dfa0e0009
4 changed files with 215 additions and 4 deletions
|
|
@ -624,9 +624,13 @@ def _resolve_outcode_postcodes(
|
|||
pc_coords: dict[str, tuple[float, float]],
|
||||
) -> list[str]:
|
||||
"""Get all postcodes for an outcode from the postcode coordinates lookup."""
|
||||
# ONSPD 7-char format: 4-char outcodes have no space before incode
|
||||
# (e.g., "BH191AB"), while shorter outcodes do (e.g., "E14 5AB").
|
||||
prefix = outcode + " "
|
||||
# Also try without space for non-standard format (e.g. "SW1Y" matches "SW1Y 4AA")
|
||||
return [pcd for pcd in pc_coords if pcd.startswith(prefix)]
|
||||
results = [pcd for pcd in pc_coords if pcd.startswith(prefix)]
|
||||
if not results and len(outcode) >= 4:
|
||||
results = [pcd for pcd in pc_coords if pcd.startswith(outcode) and len(pcd) > len(outcode)]
|
||||
return results
|
||||
|
||||
|
||||
def transform_property(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue