mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
17 lines
412 B
Ruby
17 lines
412 B
Ruby
# frozen_string_literal: true
|
|
|
|
class DataMigrations::SetPointsCountryIdsJob < ApplicationJob
|
|
queue_as :data_migrations
|
|
|
|
def perform(point_id)
|
|
point = Point.find(point_id)
|
|
country = Country.containing_point(point.lon, point.lat)
|
|
|
|
if country.present?
|
|
point.country_id = country.id
|
|
point.save!
|
|
else
|
|
Rails.logger.info("No country found for point #{point.id}")
|
|
end
|
|
end
|
|
end
|