dawarich/app/jobs/data_migrations/set_points_country_ids_job.rb
2025-07-27 01:08:29 +02:00

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