From eb4eada4812a12e321bb218fb97a83511b293295 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Wed, 31 May 2023 14:53:10 -0700 Subject: [PATCH] remove concurrent processes on claims (#12849) --- .../mobile/v0/lighthouse_claims/proxy.rb | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/modules/mobile/app/services/mobile/v0/lighthouse_claims/proxy.rb b/modules/mobile/app/services/mobile/v0/lighthouse_claims/proxy.rb index fc8f8fdd079..0e587b22ca7 100644 --- a/modules/mobile/app/services/mobile/v0/lighthouse_claims/proxy.rb +++ b/modules/mobile/app/services/mobile/v0/lighthouse_claims/proxy.rb @@ -10,6 +10,20 @@ module LighthouseClaims class Proxy < Mobile::V0::Claims::Proxy delegate :get_claim, to: :claims_service + def get_claims_and_appeals + claims = get_all_claims + appeals = get_all_appeals + + full_list = [] + errors = [] + + claims[:errors].nil? ? full_list.push(*claims[:list]) : errors.push(claims[:errors]) + appeals[:errors].nil? ? full_list.push(*appeals[:list]) : errors.push(appeals[:errors]) + data = claims_adapter.parse(full_list) + + [data, errors] + end + private def claims_adapter @@ -21,17 +35,19 @@ def claims_service end def get_all_claims - lambda { - begin - claims_list = claims_service.get_claims - { - list: claims_list['data'], - errors: nil - } - rescue => e - { list: nil, errors: Mobile::V0::Adapters::ClaimsOverviewErrors.new.parse(e, 'claims') } - end + claims_list = claims_service.get_claims + { + list: claims_list['data'], + errors: nil } + rescue => e + { list: nil, errors: Mobile::V0::Adapters::ClaimsOverviewErrors.new.parse(e, 'claims') } + end + + def get_all_appeals + { list: appeals_service.get_appeals(@user).body['data'], errors: nil } + rescue => e + { list: nil, errors: Mobile::V0::Adapters::ClaimsOverviewErrors.new.parse(e, 'appeals') } end end end