Skip to content

Commit

Permalink
Make ASSESSMENT_ADDRESS_ID_KEY a class constant
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDoubleK committed Aug 8, 2024
1 parent 70d6c04 commit e2b2ac8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/use_case/update_certificate_addresses.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module UseCase
class UpdateCertificateAddresses
ASSESSMENT_ADDRESS_ID_KEY = "assessment_address_id".freeze

def initialize(eav_gateway:, queues_gateway:, documents_gateway:, recovery_list_gateway:, logger: nil)
@assessment_attribute_gateway = eav_gateway
@queues_gateway = queues_gateway
Expand All @@ -16,14 +18,13 @@ def execute(from_recovery_list: false)
payload = @queues_gateway.consume_queue(@queue_name)
register_assessments_to_recovery_list payload
end
top_level_attribute = "assessment_address_id"

payload.each do |assessment|
payload_arr = assessment.split(":")
assessment_id = payload_arr[0]
address_id = payload_arr[1]
@documents_gateway.set_top_level_attribute assessment_id:, top_level_attribute:, new_value: address_id
@assessment_attribute_gateway.update_assessment_attribute assessment_id:, attribute: top_level_attribute, value: address_id
@documents_gateway.set_top_level_attribute assessment_id:, top_level_attribute: ASSESSMENT_ADDRESS_ID_KEY, new_value: address_id
@assessment_attribute_gateway.update_assessment_attribute assessment_id:, attribute: ASSESSMENT_ADDRESS_ID_KEY, value: address_id
clear_assessment_on_recovery_list payload: assessment
rescue StandardError => e
report_to_sentry e
Expand Down

0 comments on commit e2b2ac8

Please sign in to comment.