mirror of
https://github.com/Freika/dawarich.git
synced 2026-04-22 03:00:29 -04:00
Merge pull request #524 from Freika/fix/map-distance-calculation
Fix map and visits pages
This commit is contained in:
@@ -1 +1 @@
|
||||
0.19.4
|
||||
0.19.5
|
||||
|
||||
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
# 0.19.5 - 2024-12-10
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed a bug where the map and visits pages were throwing an error due to incorrect approach to distance calculation.
|
||||
|
||||
# 0.19.4 - 2024-12-10
|
||||
|
||||
⚠️ This release introduces a breaking change. ⚠️
|
||||
|
||||
@@ -36,7 +36,7 @@ class MapController < ApplicationController
|
||||
@distance ||= 0
|
||||
|
||||
@coordinates.each_cons(2) do
|
||||
@distance += DistanceCalculator.new([_1[0], _1[1]], [_2[0], _2[1]]).call
|
||||
@distance += Geocoder::Calculations.distance_between([_1[0], _1[1]], [_2[0], _2[1]])
|
||||
end
|
||||
|
||||
@distance.round(1)
|
||||
|
||||
@@ -29,7 +29,7 @@ class Visit < ApplicationRecord
|
||||
return area&.radius if area.present?
|
||||
|
||||
radius = points.map do |point|
|
||||
DistanceCalculator.new(center, [point.latitude, point.longitude]).call
|
||||
Geocoder::Calculations.distance_between(center, [point.latitude, point.longitude])
|
||||
end.max
|
||||
|
||||
radius && radius >= 15 ? radius : 15
|
||||
|
||||
Reference in New Issue
Block a user