mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Fix distance calculation
This commit is contained in:
parent
59a4d760bf
commit
6a6c3c938f
1 changed files with 3 additions and 3 deletions
|
|
@ -36,17 +36,17 @@ class MapController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def calculate_distance
|
def calculate_distance
|
||||||
total_distance_meters = 0
|
total_distance = 0
|
||||||
|
|
||||||
@coordinates.each_cons(2) do
|
@coordinates.each_cons(2) do
|
||||||
distance_km = Geocoder::Calculations.distance_between(
|
distance_km = Geocoder::Calculations.distance_between(
|
||||||
[_1[0], _1[1]], [_2[0], _2[1]], units: :km
|
[_1[0], _1[1]], [_2[0], _2[1]], units: :km
|
||||||
)
|
)
|
||||||
|
|
||||||
total_distance_meters += distance_km
|
total_distance += distance_km
|
||||||
end
|
end
|
||||||
|
|
||||||
total_distance_meters.round
|
total_distance.round
|
||||||
end
|
end
|
||||||
|
|
||||||
def parsed_start_at
|
def parsed_start_at
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue