mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
16 lines
376 B
Ruby
16 lines
376 B
Ruby
class ReverseGeocodingJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform(point_id)
|
|
point = Point.find(point_id)
|
|
return if point.city.present? && point.country.present?
|
|
|
|
result = Geocoder.search([point.latitude, point.longitude])
|
|
return if result.blank?
|
|
|
|
point.update(
|
|
city: result.first.city,
|
|
country: result.first.country
|
|
)
|
|
end
|
|
end
|