dawarich/app/jobs/data_migrations/set_points_country_ids_job.rb
2025-05-20 19:40:54 +02:00

17 lines
404 B
Ruby

# frozen_string_literal: true
class DataMigrations::SetPointsCountryIdsJob < ApplicationJob
queue_as :default
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