Refactor en geocoder para evitar error con respuestas sin resultados.
This commit is contained in:
parent
5ec97ad008
commit
812bb66219
1 changed files with 12 additions and 11 deletions
|
|
@ -48,7 +48,7 @@ class Geocoder:
|
|||
|
||||
while not task.is_successfull():
|
||||
task.geocode()
|
||||
if task.tries < 3 or task.success_surrender_retry == 'Surrender':
|
||||
if task.tries > 3 or task.success_surrender_retry == 'Surrender':
|
||||
geo_data = {'latitude': None,
|
||||
'longitude': None,
|
||||
'precision': 'SIN RESULTADOS'}
|
||||
|
|
@ -59,18 +59,19 @@ class Geocoder:
|
|||
geo_data['precision'])
|
||||
break
|
||||
|
||||
geo_data = task.get_results()
|
||||
if not (task.tries > 3 or task.success_surrender_retry == 'Surrender'):
|
||||
geo_data = task.get_results()
|
||||
|
||||
self.cache.add_address(address,
|
||||
geo_data['latitude'],
|
||||
geo_data['longitude'],
|
||||
geo_data['precision'])
|
||||
self.cache.add_address(address,
|
||||
geo_data['latitude'],
|
||||
geo_data['longitude'],
|
||||
geo_data['precision'])
|
||||
|
||||
capturas_interface.update_geo_data(ad_data['referencia'],
|
||||
ad_data['fecha_captura'],
|
||||
geo_data['latitude'],
|
||||
geo_data['longitude'],
|
||||
geo_data['precision'])
|
||||
capturas_interface.update_geo_data(ad_data['referencia'],
|
||||
ad_data['fecha_captura'],
|
||||
geo_data['latitude'],
|
||||
geo_data['longitude'],
|
||||
geo_data['precision'])
|
||||
|
||||
|
||||
class GeocodingCache:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue