diff --git a/app/jobs/harvest_import_job.rb b/app/jobs/harvest_import_job.rb index 352e0244..12e93730 100644 --- a/app/jobs/harvest_import_job.rb +++ b/app/jobs/harvest_import_job.rb @@ -6,6 +6,6 @@ class HarvestImportJob < ApplicationJob def perform Project.sync_with_harvest Invoice.sync_with_harvest - Sprint.within(1.year).find_each(&:sync_with_harvest) + Sprint.within(2.months).find_each(&:sync_with_harvest) end end diff --git a/app/models/sprint/harvest.rb b/app/models/sprint/harvest.rb index 3423d72e..dd0478b3 100644 --- a/app/models/sprint/harvest.rb +++ b/app/models/sprint/harvest.rb @@ -11,7 +11,7 @@ def sync_with_harvest harvest_entries = HarvestApi.instance.time_entries(from: sprint_from, to: sprint_until) deleted_ids = time_entries.pluck(:external_id) - harvest_entries.map(&:id) - entries = harvest_entries.map do |e| + entries = harvest_entries.filter_map do |e| next if user_ids_by_email[e.user].nil? project_id = project_ids_for_harvest[e.project_id]