dawarich/app/jobs/overland/batch_creating_job.rb

19 lines
382 B
Ruby
Raw Normal View History

# 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|
next if location[:lonlat].nil?
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