Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions app/services/db/sp_return_log.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Db
class SpReturnLog
# rubocop:disable Rails/SkipsModelValidations
def self.create_return(request_id:, user_id:, billable:, ial:, issuer:, requested_at:)
::SpReturnLog.create!(
request_id: request_id,
Expand All @@ -12,15 +11,7 @@ def self.create_return(request_id:, user_id:, billable:, ial:, issuer:, requeste
returned_at: Time.zone.now,
)
rescue ActiveRecord::RecordNotUnique
# Can be removed after deploy of RC 185
::SpReturnLog.where(request_id: request_id).update_all(
user_id: user_id,
returned_at: Time.zone.now,
billable: billable,
ial: ial,
)
nil
end
# rubocop:enable Rails/SkipsModelValidations
end
end
1 change: 0 additions & 1 deletion config/initializers/job_configurations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
cron: cron_24h,
args: -> { [Time.zone.today] },
},
# Send Sp Success Rate Report to S3
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

# Proofing Costs Report to S3
proofing_costs: {
class: 'Reports::ProofingCostsReport',
Expand Down
7 changes: 4 additions & 3 deletions spec/services/db/sp_return_log_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

describe Db::SpReturnLog do
describe '#create_return' do
# Can be removed after deploy of RC 185
it 'updates return log if it already exists' do
it 'does not fail if row already exists' do
sp_return_log = SpReturnLog.create(
request_id: SecureRandom.uuid,
user_id: 1,
Expand All @@ -12,6 +11,7 @@
issuer: 'example.com',
requested_at: Time.zone.now,
)

Db::SpReturnLog.create_return(
request_id: sp_return_log.request_id,
user_id: sp_return_log.user_id,
Expand All @@ -20,7 +20,8 @@
issuer: sp_return_log.issuer,
requested_at: sp_return_log.requested_at,
)
expect(sp_return_log.reload.returned_at).to_not be_nil

expect(SpReturnLog.count).to eq 1
end
end
end