Permalink
Browse files

Merge pull request #2411 from ekylibre/debug/equipment-form-geolocation

Fixed marker creation for new equipment/issues/analysis form geolocation
  • Loading branch information...
Aquaj committed Feb 7, 2019
2 parents 5b28369 + 89866b3 commit 99c8300d9cd20778f26c8c46f8e5864f6a3479a8
Showing with 2 additions and 1 deletion.
  1. +2 −1 app/helpers/backend/form_builder.rb
@@ -365,7 +365,8 @@ def point(attribute_name, options = {})
else
siblings = @object.class.where("#{attribute_name} IS NOT NULL").order(id: :desc)
if siblings.any?
marker[:view] = { center: Charta.new_geometry(siblings.first.send(attribute_name)).centroid }
sibling_point = siblings.first.send(attribute_name).to_rgeo
marker[:view] = { center: [sibling_point.lat, sibling_point.lon] }
elsif zone = CultivableZone.first
marker[:view] = { center: zone.shape_centroid }
end

0 comments on commit 99c8300

Please sign in to comment.