2024-05-18 07:58:02 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2024-04-06 13:09:38 -04:00
|
|
|
class Overland::BatchCreatingJob < ApplicationJob
|
2025-03-03 16:39:43 -05:00
|
|
|
include PointValidation
|
|
|
|
|
|
2025-05-21 12:57:29 -04:00
|
|
|
queue_as :points
|
2024-04-06 13:09:38 -04:00
|
|
|
|
2024-05-25 07:26:56 -04:00
|
|
|
def perform(params, user_id)
|
2024-04-06 13:09:38 -04:00
|
|
|
data = Overland::Params.new(params).call
|
|
|
|
|
|
|
|
|
|
data.each do |location|
|
2025-05-17 13:14:28 -04:00
|
|
|
next if location[:lonlat].nil?
|
2024-05-29 17:12:00 -04:00
|
|
|
next if point_exists?(location, user_id)
|
|
|
|
|
|
2024-05-25 07:26:56 -04:00
|
|
|
Point.create!(location.merge(user_id:))
|
2024-04-06 13:09:38 -04:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|