Skip to content

Commit

Permalink
Fix sync logs query to use task name rather than the class name
Browse files Browse the repository at this point in the history
Task name was changed so that it was decoupled from the implementation class. Must have missed these when I made that change.
  • Loading branch information
agamble committed Aug 15, 2024
1 parent a5ad6a4 commit 2b0f5ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/lib/ingestors/google/docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def google_drive_client
end

def search_query
last_sync_at = user.sync_logs.where(task_name: 'Sync::GoogleDocsJob')&.maximum(:started_at)
last_sync_at = user.sync_logs.where(task_name: Integration.from_key!(:google_docs).key)&.maximum(:started_at)

if last_sync_at.present?
"mimeType = 'application/vnd.google-apps.document' and modifiedTime > '#{last_sync_at.strftime('%Y-%m-%dT%H:%M:%S')}'"
Expand Down
2 changes: 1 addition & 1 deletion app/lib/ingestors/google/gmail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def extract_headers(headers)
end

def search_query
latest_sync_at = user.sync_logs.where(task_name: 'Sync::GmailMessagesJob')&.maximum(:started_at)
latest_sync_at = user.sync_logs.where(task_name: Integration.from_key!(:gmail).key)&.maximum(:started_at)
if latest_sync_at.present?
"in:anywhere after:#{latest_sync_at.strftime('%Y/%m/%d')}"
else
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/ingestors/google/gmail_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)
end

let(:sync_log) { create(:sync_log, task_name: 'Sync::GmailMessagesJob', user:) }
let(:sync_log) { create(:sync_log, task_name: :gmail, user:) }
let(:message_content) { '<p>Test Body</p>' }

before do
Expand Down

0 comments on commit 2b0f5ef

Please sign in to comment.