Try fallback to address if location is missing
This commit is contained in:
parent
0da04a4b6e
commit
b19459b97f
@ -147,14 +147,19 @@ def guess_postal_code(flats_list, constraint, config, distance_threshold=20000):
|
|||||||
|
|
||||||
for flat in flats_list:
|
for flat in flats_list:
|
||||||
location = flat.get("location", None)
|
location = flat.get("location", None)
|
||||||
|
if not location:
|
||||||
|
addr = flat.get("address", None)
|
||||||
|
if addr:
|
||||||
|
location = addr['full_address']
|
||||||
if not location:
|
if not location:
|
||||||
# Skip everything if empty location
|
# Skip everything if empty location
|
||||||
LOGGER.info(
|
LOGGER.info(
|
||||||
(
|
(
|
||||||
"No location field for flat %s, skipping postal "
|
"No location field for flat %s, skipping postal "
|
||||||
"code lookup."
|
"code lookup. (%s)"
|
||||||
),
|
),
|
||||||
flat["id"]
|
flat["id"],
|
||||||
|
flat["address"]
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user