From f79748c113192c254ef8b6b9591d7e3707d74e9b Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Tue, 12 May 2020 17:37:48 -0700 Subject: [PATCH] Touch up distance API --- fgs/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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