diff --git a/fgs/views.py b/fgs/views.py index 162ad26..42f6049 100644 --- a/fgs/views.py +++ b/fgs/views.py @@ -48,8 +48,9 @@ def collars_distance(): distance_kilometers = 0 coords_pairs = list(map(lambda e : (e.longitude, e.latitude), coords)) + if len(coord_pairs) < 1: continue - coord_last = coords_pairs.pop() + coord_last = coords_pairs.pop(0) for coord in coords_pairs: distance_kilometers += geopy.distance.VincentyDistance(coord_last,coord).km coord_last = coord