mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -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
|
||||
|
||||
def calculate_distance
|
||||
total_distance_meters = 0
|
||||
total_distance = 0
|
||||
|
||||
@coordinates.each_cons(2) do
|
||||
distance_km = Geocoder::Calculations.distance_between(
|
||||
[_1[0], _1[1]], [_2[0], _2[1]], units: :km
|
||||
)
|
||||
|
||||
total_distance_meters += distance_km
|
||||
total_distance += distance_km
|
||||
end
|
||||
|
||||
total_distance_meters.round
|
||||
total_distance.round
|
||||
end
|
||||
|
||||
def parsed_start_at
|
||||
|
|
|
|||
Loading…
Reference in a new issue