Skip to content

Commit

Permalink
80792 remove redis client refactor feature flag (#16353)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomsync authored Apr 17, 2024
1 parent e803313 commit c04424a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 59 deletions.
4 changes: 0 additions & 4 deletions config/features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ features:
actor_type: user
description: Enables the unified experience version of the landing page.
enable_in_development: true
check_in_experience_travel_claim_redis_client_refactor:
actor_type: user
description: Uses the refactored code for Travel Claim Redis client to fetch attributes
enable_in_development: true
claim_letters_access:
actor_type: user
description: Enables users to access the claim letters page
Expand Down
40 changes: 5 additions & 35 deletions modules/check_in/app/services/travel_claim/redis_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,53 +33,23 @@ def save_token(token:)
end

def icn(uuid:)
if Flipper.enabled?('check_in_experience_travel_claim_redis_client_refactor')
return fetch_attribute(uuid:, attribute: :icn)
end

return nil if appointment_identifiers(uuid:).nil?

Oj.load(appointment_identifiers(uuid:)).with_indifferent_access.dig(:data, :attributes, :icn)
fetch_attribute(uuid:, attribute: :icn)
end

def mobile_phone(uuid:)
if Flipper.enabled?('check_in_experience_travel_claim_redis_client_refactor')
return fetch_attribute(uuid:, attribute: :mobilePhone)
end

return nil if appointment_identifiers(uuid:).nil?

Oj.load(appointment_identifiers(uuid:)).with_indifferent_access.dig(:data, :attributes, :mobilePhone)
fetch_attribute(uuid:, attribute: :mobilePhone)
end

def patient_cell_phone(uuid:)
if Flipper.enabled?('check_in_experience_travel_claim_redis_client_refactor')
return fetch_attribute(uuid:, attribute: :patientCellPhone)
end

return nil if appointment_identifiers(uuid:).nil?

Oj.load(appointment_identifiers(uuid:)).with_indifferent_access.dig(:data, :attributes, :patientCellPhone)
fetch_attribute(uuid:, attribute: :patientCellPhone)
end

def station_number(uuid:)
if Flipper.enabled?('check_in_experience_travel_claim_redis_client_refactor')
return fetch_attribute(uuid:, attribute: :stationNo)
end

return nil if appointment_identifiers(uuid:).nil?

Oj.load(appointment_identifiers(uuid:)).with_indifferent_access.dig(:data, :attributes, :stationNo)
fetch_attribute(uuid:, attribute: :stationNo)
end

def facility_type(uuid:)
if Flipper.enabled?('check_in_experience_travel_claim_redis_client_refactor')
return fetch_attribute(uuid:, attribute: :facilityType)
end

return nil if appointment_identifiers(uuid:).nil?

Oj.load(appointment_identifiers(uuid:)).with_indifferent_access.dig(:data, :attributes, :facilityType)
fetch_attribute(uuid:, attribute: :facilityType)
end

def fetch_attribute(uuid:, attribute:)
Expand Down
21 changes: 1 addition & 20 deletions modules/check_in/spec/services/travel_claim/redis_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@

before do
allow(Rails).to receive(:cache).and_return(memory_store)
allow(Flipper).to receive(:enabled?).with('check_in_experience_travel_claim_redis_client_refactor')
.and_return(false)

Rails.cache.clear
end

Expand Down Expand Up @@ -201,23 +198,7 @@
)
end

context 'when cache exists and refactor feature flag is off' do
before do
allow(Flipper).to receive(:enabled?).with('check_in_experience_travel_claim_redis_client_refactor')
.and_return(false)
end

it 'returns the cached value' do
expect(redis_client.facility_type(uuid:)).to eq(facility_type)
end
end

context 'when cache exists and refactor feature flag is on' do
before do
allow(Flipper).to receive(:enabled?).with('check_in_experience_travel_claim_redis_client_refactor')
.and_return(true)
end

context 'when cache exists' do
it 'returns the cached value' do
expect(redis_client.facility_type(uuid:)).to eq(facility_type)
end
Expand Down

0 comments on commit c04424a

Please sign in to comment.