mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Optimize bulk visits suggesting job
This commit is contained in:
parent
b7aa05f4ea
commit
6ec24ffc3d
1 changed files with 3 additions and 2 deletions
|
|
@ -11,13 +11,14 @@ class BulkVisitsSuggestingJob < ApplicationJob
|
|||
return unless DawarichSettings.reverse_geocoding_enabled?
|
||||
|
||||
users = user_ids.any? ? User.active.where(id: user_ids) : User.active
|
||||
users = users.select { _1.safe_settings.visits_suggestions_enabled? }
|
||||
|
||||
start_at = start_at.to_datetime
|
||||
end_at = end_at.to_datetime
|
||||
|
||||
time_chunks = Visits::TimeChunks.new(start_at:, end_at:).call
|
||||
|
||||
users.active.find_each do |user|
|
||||
next unless user.safe_settings.visits_suggestions_enabled?
|
||||
users.find_each do |user|
|
||||
next if user.tracked_points.empty?
|
||||
|
||||
schedule_chunked_jobs(user, time_chunks)
|
||||
|
|
|
|||
Loading…
Reference in a new issue