diff --git a/app/jobs/scrape_toggl_job.rb b/app/jobs/scrape_toggl_job.rb index 7faf5ff..86e7b68 100644 --- a/app/jobs/scrape_toggl_job.rb +++ b/app/jobs/scrape_toggl_job.rb @@ -31,6 +31,9 @@ class ScrapeTogglJob < ApplicationJob entries_data.each do |entry| entry_title = entry['description'] + # Skip if we've already seen this entry, NOTE: we assume that there is only one inner_entry per time entry + next if TrackedTimeEntry.exists?(associated_toggl_entry_id: entry['time_entries'][0]['id']) + if (lecture = lectures.find_by(title: entry_title)) is_concurrent = entry['time_entries'].any? do |inner_entry| (Time.new(inner_entry['start']) - lecture.start_time).abs < 10.minutes