Merge branch 'master' into feature/tags
This commit is contained in:
commit
fc39b46c52
@ -60,13 +60,16 @@ class Place (models.Model):
|
||||
def average_latlon(place_list):
|
||||
amount = len(place_list)
|
||||
# Init fill values to prevent None
|
||||
longitude = 1
|
||||
latitude = 1
|
||||
longitude = 0
|
||||
latitude = 0
|
||||
|
||||
for place in place_list:
|
||||
longitude += place.longitude
|
||||
latitude += place.latitude
|
||||
return (latitude / amount, longitude / amount)
|
||||
if amount > 0:
|
||||
for place in place_list:
|
||||
longitude += place.longitude
|
||||
latitude += place.latitude
|
||||
return (latitude / amount, longitude / amount)
|
||||
|
||||
return (latitude, longitude)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
Loading…
Reference in New Issue
Block a user