mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
Revert "Imported points will now be reverse geocoded only after import is finished."
This commit is contained in:
parent
039c4efc1d
commit
1e9f539dac
6 changed files with 5 additions and 22 deletions
|
|
@ -1 +1 @@
|
|||
0.21.2
|
||||
0.21.3
|
||||
|
|
|
|||
|
|
@ -33,9 +33,8 @@ class Point < ApplicationRecord
|
|||
Time.zone.at(timestamp)
|
||||
end
|
||||
|
||||
def async_reverse_geocode(force: false)
|
||||
def async_reverse_geocode
|
||||
return unless REVERSE_GEOCODING_ENABLED
|
||||
return if import_id.present? && !force
|
||||
|
||||
ReverseGeocodingJob.perform_later(self.class.to_s, id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ class Imports::Create
|
|||
|
||||
schedule_stats_creating(user.id)
|
||||
schedule_visit_suggesting(user.id, import)
|
||||
schedule_reverse_geocoding(user.id)
|
||||
rescue StandardError => e
|
||||
create_import_failed_notification(import, user, e)
|
||||
end
|
||||
|
|
@ -48,10 +47,6 @@ class Imports::Create
|
|||
VisitSuggestingJob.perform_later(user_ids: [user_id], start_at:, end_at:)
|
||||
end
|
||||
|
||||
def schedule_reverse_geocoding(user_id)
|
||||
EnqueueBackgroundJob.perform_later('continue_reverse_geocoding', user_id)
|
||||
end
|
||||
|
||||
def create_import_finished_notification(import, user)
|
||||
Notifications::Create.new(
|
||||
user:,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class Jobs::Create
|
|||
end
|
||||
|
||||
points.find_each(batch_size: 1_000) do |point|
|
||||
point.async_reverse_geocode(force: true)
|
||||
point.async_reverse_geocode
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -56,14 +56,8 @@ RSpec.describe Point, type: :model do
|
|||
context 'when point is imported' do
|
||||
let(:point) { build(:point, import_id: 1) }
|
||||
|
||||
it 'does not enqueue ReverseGeocodeJob' do
|
||||
expect { point.async_reverse_geocode }.not_to have_enqueued_job(ReverseGeocodingJob)
|
||||
end
|
||||
|
||||
context 'when reverse geocoding is forced' do
|
||||
it 'enqueues ReverseGeocodeJob' do
|
||||
expect { point.async_reverse_geocode(force: true) }.to have_enqueued_job(ReverseGeocodingJob)
|
||||
end
|
||||
it 'enqueues ReverseGeocodeJob' do
|
||||
expect { point.async_reverse_geocode }.to have_enqueued_job(ReverseGeocodingJob)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -55,11 +55,6 @@ RSpec.describe Imports::Create do
|
|||
expect { service.call }.to have_enqueued_job(VisitSuggestingJob)
|
||||
end
|
||||
end
|
||||
|
||||
it 'schedules reverse geocoding' do
|
||||
expect { service.call }.to \
|
||||
have_enqueued_job(EnqueueBackgroundJob).with('continue_reverse_geocoding', user.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when import fails' do
|
||||
|
|
|
|||
Loading…
Reference in a new issue