Skip to content

Commit

Permalink
Merge branch 'master' into sjc-veteran-representative-migration
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjcumming authored Apr 17, 2024
2 parents e340c5a + 3bc601f commit 3fef097
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 68 deletions.
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,9 @@ GEM
rchardet (1.8.0)
rdoc (6.6.3.1)
psych (>= 4.0.0)
redis (5.1.0)
redis-client (>= 0.17.0)
redis-client (0.20.0)
redis (5.2.0)
redis-client (>= 0.22.0)
redis-client (0.22.0)
connection_pool
redis-namespace (1.11.0)
redis (>= 4)
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"form1[0].#subform[3].CheckBox1[1]": "<%= nil %>",
"form1[0].#subform[3].Email_Address[3]": "<%= nil %>",
"form1[0].#subform[3].VA_File_Number_If_Applicable[1]": "<%= form.data.dig('veteran_id', 'va_file_number') %>",
"form1[0].#subform[3].CurrentlyHomeless[0]": "<%= form.data.dig('living_situation', 'none') ? 1 : 0 %>",

"form1[0].#subform[4].I_Live_Or_Sleep_In_A_Place_That_Is_Not_Meant_For_Regular_Sleeping[0]": "<%= form.data.dig('living_situation', 'overnight') ? 1 : 0 %>",
"form1[0].#subform[4].I_Live_In_A_Shelter[0]": "<%= form.data.dig('living_situation', 'shelter') ? 1 : 0 %>",
Expand All @@ -57,10 +58,8 @@
"form1[0].#subform[4].IN_THE_NEXT_30_DAYS_I_WILL_LOSE_MY_HOME[0]": "<%= form.data.dig('living_situation', 'losing_home') ? 1 : 0 %>",
"form1[0].#subform[4].NONE_OF_THESE_SITUATIONS_APPLY_TO_ME[0]": "<%= form.data.dig('living_situation', 'none') ? 1 : 0 %>",
"form1[0].#subform[4].OTHER_Specify[0]": "<%= form.data.dig('living_situation', 'other_risk') ? 1 : 0 %>",

"form1[0].#subform[3].CurrentlyHomeless[0]": "<%= form.data.dig('living_situation', 'none') ? 1 : 0 %>",
"form1[0].#subform[4].Other1[0]": "<%= form.data['other_housing_risks'] %>",

"form1[0].#subform[3].Other1[0]": "<%= form.data['other_housing_risks'] %>",
"form1[0].#subform[4].Veterans_SocialSecurityNumber_LastFourNumbers[1]": "<%= form.data.dig('veteran_id', 'ssn')&.[](5..8) %>",
"form1[0].#subform[4].Veterans_SocialSecurityNumber_SecondTwoNumbers[1]": "<%= form.data.dig('veteran_id', 'ssn')&.[](3..4) %>",
"form1[0].#subform[4].Veterans_SocialSecurityNumber_FirstThreeNumbers[1]": "<%= form.data.dig('veteran_id', 'ssn')&.[](0..2) %>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def self.stamp_auth_text(stamped_template_path, current_loa)
end
coords = [10, 10]
text = SUBMISSION_TEXT + current_time
page = 0
desired_stamp = { coords:, text:, page: }
desired_stamp = { coords:, text: }
verify(stamped_template_path) do
stamp(desired_stamp, stamped_template_path, append_to_stamp: auth_text, text_only: false)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
},
"living_situation": {
"overnight": true,
"losing_home": true
"losing_home": true,
"other_risk": true
},
"other_housing_risks": "Other housing risks",
"mailing_address_yes_no": true,
Expand Down

0 comments on commit 3fef097

Please sign in to comment.