Fix: get country code only if we have a valid position

pull/52/head
Konstantin Gründger 2016-05-22 07:29:12 +02:00
rodzic 70ce7eebff
commit 829f52f658
1 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -100,8 +100,9 @@ def update_receivers():
for receiver in unknown_country_query.all():
location = receiver.location
receiver.country_code = get_country_code(location.latitude, location.longitude)
if receiver.country_code is not None:
logger.info("Updated country_code for {} to {}".format(receiver.name, receiver.country_code))
if location is not None:
receiver.country_code = get_country_code(location.latitude, location.longitude)
if receiver.country_code is not None:
logger.info("Updated country_code for {} to {}".format(receiver.name, receiver.country_code))
app.session.commit()