From dcb5b91ff8036aa3413aad908de3ac7f7049c2c1 Mon Sep 17 00:00:00 2001 From: Eric Tillberg Date: Thu, 11 Apr 2024 14:59:56 -0400 Subject: [PATCH] More fixes for 20-10207 (#16302) * More fixes for 20-10207 * cleanup * fix fixture --- .../app/form_mappings/vba_20_10207.json.erb | 42 +++++++++---------- .../models/simple_forms_api/vba_20_10207.rb | 6 +-- .../form_json/vba_20_10207-non-veteran.json | 16 +++---- .../form_json/vba_20_10207-veteran.json | 18 ++++---- 4 files changed, 39 insertions(+), 43 deletions(-) diff --git a/modules/simple_forms_api/app/form_mappings/vba_20_10207.json.erb b/modules/simple_forms_api/app/form_mappings/vba_20_10207.json.erb index a12c86a7ab2..a3a3b994c65 100644 --- a/modules/simple_forms_api/app/form_mappings/vba_20_10207.json.erb +++ b/modules/simple_forms_api/app/form_mappings/vba_20_10207.json.erb @@ -50,15 +50,15 @@ "form1[0].#subform[3].Email_Address[3]": "<%= nil %>", "form1[0].#subform[3].VA_File_Number_If_Applicable[1]": "<%= nil %>", - "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 %>", - "form1[0].#subform[4].Staying_With_A_Friend_Or_Family_Member_Because_I_Am_Unable_To_Own_A_Home_Right_Now[0]": "<%= form.data.dig('living_situation', 'FRIEND_OR_FAMILY') ? 1 : 0 %>", - "form1[0].#subform[4].In_The_Next_30_Days_I_Will_Have_To_Leave_A_Facility_Like_A_Homeless_Shelter[0]": "<%= form.data.dig('living_situation', 'LEAVING_SHELTER') ? 1 : 0 %>", - "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[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 %>", + "form1[0].#subform[4].Staying_With_A_Friend_Or_Family_Member_Because_I_Am_Unable_To_Own_A_Home_Right_Now[0]": "<%= form.data.dig('living_situation', 'friend_or_family') ? 1 : 0 %>", + "form1[0].#subform[4].In_The_Next_30_Days_I_Will_Have_To_Leave_A_Facility_Like_A_Homeless_Shelter[0]": "<%= form.data.dig('living_situation', 'leaving_shelter') ? 1 : 0 %>", + "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[3].CurrentlyHomeless[0]": "<%= form.data.dig('living_situation', 'none') ? 1 : 0 %>", "form1[0].#subform[3].Other1[0]": "<%= nil %>", "form1[0].#subform[4].Veterans_SocialSecurityNumber_LastFourNumbers[1]": "<%= form.data.dig('veteran_id', 'ssn')&.[](5..8) %>", @@ -73,13 +73,13 @@ "form1[0].#subform[4].International_Telephone_Number_If_Applicable[0]": "<%= nil %>", "form1[0].#subform[4].POINT_OF_CONTACT[0]": "<%= form.data['point_of_contact_name'] %>", - "form1[0].#subform[4].OtherReasonsForRequest[0]": "<%= form.data.dig('other_reasons', 'FORMER_POW') ? 1 : 0 %>", - "form1[0].#subform[4].OtherReasonsForRequest[1]": "<%= form.data.dig('other_reasons', 'VSI_SI') ? 1 : 0 %>", - "form1[0].#subform[4].OtherReasonsForRequest[2]": "<%= form.data.dig('other_reasons', 'ALS') ? 1 : 0 %>", - "form1[0].#subform[4].OtherReasonsForRequest[3]": "<%= form.data.dig('other_reasons', 'FINANCIAL_HARDSHIP') ? 1 : 0 %>", - "form1[0].#subform[4].OtherReasonsForRequest[4]": "<%= form.data.dig('other_reasons', 'TERMINAL_ILLNESS') ? 1 : 0 %>", - "form1[0].#subform[4].OtherReasonsForRequest[5]": "<%= form.data.dig('other_reasons', 'MEDAL_AWARD') ? 1 : 0 %>", - "form1[0].#subform[4].OtherReasonsForRequest[6]": "<%= form.data.dig('other_reasons', 'OVER_85') ? 1 : 0 %>", + "form1[0].#subform[4].OtherReasonsForRequest[0]": "<%= form.data.dig('other_reasons', 'former_pow') ? 6 : 0 %>", + "form1[0].#subform[4].OtherReasonsForRequest[1]": "<%= form.data.dig('other_reasons', 'vsi_si') ? 7 : 0 %>", + "form1[0].#subform[4].OtherReasonsForRequest[2]": "<%= form.data.dig('other_reasons', 'als') ? 4 : 0 %>", + "form1[0].#subform[4].OtherReasonsForRequest[3]": "<%= form.data.dig('other_reasons', 'financial_hardship') ? 1 : 0 %>", + "form1[0].#subform[4].OtherReasonsForRequest[4]": "<%= form.data.dig('other_reasons', 'terminal_illness') ? 2 : 0 %>", + "form1[0].#subform[4].OtherReasonsForRequest[5]": "<%= form.data.dig('other_reasons', 'medal_award') ? 3 : 0 %>", + "form1[0].#subform[4].OtherReasonsForRequest[6]": "<%= form.data.dig('other_reasons', 'over_85') ? 5 : 0 %>", "form1[0].#subform[4].Month[1]": "<%= form.data['pow_confinement_start_date']&.[](5..6) %>", "form1[0].#subform[4].Day[1]": "<%= form.data['pow_confinement_start_date']&.[](8..9) %>", "form1[0].#subform[4].Year[1]": "<%= form.data['pow_confinement_start_date']&.[](0..3) %>", @@ -93,26 +93,22 @@ "form1[0].#subform[4].Day[7]": "<%= form.data['pow_confinement2end_date']&.[](8..9) %>", "form1[0].#subform[4].Year[7]": "<%= form.data['pow_confinement2end_date']&.[](0..3) %>", - "form1[0].#subform[4].NameOfFacility1[0]": "<%= form.facility_name(1) %>", + "form1[0].#subform[4].Name_And_Location_Of_Treatment_Facility1[0]": "<%= form.facility_name(1) %>", "form1[0].#subform[4].DateOfTreatment_Month1[0]": "<%= form.facility_month(1) %>", "form1[0].#subform[4].DateOfTreatment_Day1[0]": "<%= form.facility_day(1) %>", "form1[0].#subform[4].DateOfTreatment_Year1[0]": "<%= form.facility_year(1) %>", - "form1[0].#subform[4].NameOfFacility2[0]": "<%= form.facility_name(2) %>", + "form1[0].#subform[4].Name_And_Location_Of_Treatment_Facility2[0]": "<%= form.facility_name(2) %>", "form1[0].#subform[4].DateOfTreatment_Month2[0]": "<%= form.facility_month(2) %>", "form1[0].#subform[4].DateOfTreatment_Day2[0]": "<%= form.facility_day(2) %>", "form1[0].#subform[4].DateOfTreatment_Year2[0]": "<%= form.facility_year(2) %>", - "form1[0].#subform[4].NameOfFacility3[0]": "<%= form.facility_name(3) %>", + "form1[0].#subform[4].Name_And_Location_Of_Treatment_Facility3[0]": "<%= form.facility_name(3) %>", "form1[0].#subform[4].DateOfTreatment_Month3[0]": "<%= form.facility_month(3) %>", "form1[0].#subform[4].DateOfTreatment_Day3[0]": "<%= form.facility_day(3) %>", "form1[0].#subform[4].DateOfTreatment_Year3[0]": "<%= form.facility_year(3) %>", - "form1[0].#subform[4].NameOfFacility4[0]": "<%= form.facility_name(4) %>", + "form1[0].#subform[4].Name_And_Location_Of_Treatment_Facility4[0]": "<%= form.facility_name(4) %>", "form1[0].#subform[4].DateOfTreatment_Month4[0]": "<%= form.facility_month(4) %>", "form1[0].#subform[4].DateOfTreatment_Day4[0]": "<%= form.facility_day(4) %>", "form1[0].#subform[4].DateOfTreatment_Year4[0]": "<%= form.facility_year(4) %>", - "form1[0].#subform[4].NameOfFacility5[0]": "<%= form.facility_name(5) %>", - "form1[0].#subform[4].DateOfTreatment_Month5[0]": "<%= form.facility_month(5) %>", - "form1[0].#subform[4].DateOfTreatment_Day5[0]": "<%= form.facility_day(5) %>", - "form1[0].#subform[4].DateOfTreatment_Year5[0]": "<%= form.facility_year(5) %>", "form1[0].#subform[5].RequesterSignature[0]": "<%= form.requester_signature %>", "form1[0].#subform[5].RequesterDateSigned_Month[0]": "<%= form.requester_signature ? Time.current.in_time_zone('America/Chicago').strftime('%m') : nil %>", diff --git a/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb b/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb index 5401691a3cf..ff00fb4d991 100644 --- a/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb +++ b/modules/simple_forms_api/app/models/simple_forms_api/vba_20_10207.rb @@ -12,14 +12,14 @@ def initialize(data) def facility_name(index) facility = @data['medical_treatments']&.[](index - 1) - "#{facility&.[]('facility_name')}\n#{facility_address(index)}" + "#{facility&.[]('facility_name')}\\n#{facility_address(index)}" end def facility_address(index) facility = @data['medical_treatments']&.[](index - 1) address = facility&.[]('facility_address') - "#{address&.[]('street')}\n" \ - "#{address&.[]('city')}, #{address&.[]('state')} #{address&.[]('postal_code')}\n" \ + "#{address&.[]('street')}" \ + "#{address&.[]('city')}, #{address&.[]('state')}\\n#{address&.[]('postal_code')}\\n" \ "#{address&.[]('country')}" end diff --git a/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-non-veteran.json b/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-non-veteran.json index 59d048e4b8c..8a1cb918faa 100644 --- a/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-non-veteran.json +++ b/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-non-veteran.json @@ -12,7 +12,7 @@ "va_file_number": "123456789" }, "living_situation": { - "NONE": true + "none": true }, "mailing_address_yes_no": true, "non_veteran_mailing_address": { @@ -37,13 +37,13 @@ }, "veteran_insurance_file_number": "987654321", "other_reasons": { - "FINANCIAL_HARDSHIP": true, - "ALS": true, - "TERMINAL_ILLNESS": true, - "VSI_SI": true, - "OVER_85": true, - "FORMER_POW": true, - "MEDAL_AWARD": true + "financial_hardship": true, + "als": true, + "terminal_illness": true, + "vsi_si": true, + "over_85": true, + "former_pow": true, + "medal_award": true }, "pow_confinement_start_date": "2013-01-01", "pow_confinement_end_date": "2013-01-02", diff --git a/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-veteran.json b/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-veteran.json index 2f22efb67a4..0f8c643a31c 100644 --- a/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-veteran.json +++ b/modules/simple_forms_api/spec/fixtures/form_json/vba_20_10207-veteran.json @@ -10,8 +10,8 @@ "ssn": "321540987" }, "living_situation": { - "OVERNIGHT": true, - "LOSING_HOME": true + "overnight": true, + "losing_home": true }, "other_housing_risks": "Other housing risks", "mailing_address_yes_no": true, @@ -24,13 +24,13 @@ }, "veteran_phone": "1234567890", "other_reasons": { - "FINANCIAL_HARDSHIP": true, - "ALS": true, - "TERMINAL_ILLNESS": true, - "VSI_SI": true, - "FORMER_POW": true, - "MEDAL_AWARD": true, - "OVER_85": true + "financial_hardship": true, + "als": true, + "terminal_illness": true, + "vsi_si": true, + "former_pow": true, + "medal_award": true, + "over_85": true }, "pow_confinement_start_date": "2018-01-01", "pow_confinement_end_date": "2018-02-03",