From 35767c0c3e9b1d3156b0fd64362c6b8f91ff988c Mon Sep 17 00:00:00 2001 From: Eric Tillberg Date: Mon, 15 Apr 2024 10:53:50 -0400 Subject: [PATCH] More fixes for 20-10207 (#16312) * More fixes for 20-10207 * cleanup * Fix signatures on 20-10207 * rubocop --------- Co-authored-by: Rebecca Tolmach <10993987+rmtolmach@users.noreply.github.com> --- .../app/form_mappings/vba_20_10207.json.erb | 24 +++++++++---------- .../models/simple_forms_api/vba_20_10207.rb | 8 +++---- .../form_json/vba_20_10207-veteran.json | 1 + .../spec/models/vba_20_10207_spec.rb | 7 +++--- 4 files changed, 20 insertions(+), 20 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 a3a3b994c65..dcbb0119b2e 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 @@ -12,7 +12,7 @@ "form1[0].#subform[3].TelephoneNumber_FirstThreeNumbers[0]": "<%= form.data['veteran_phone']&.gsub('-', '')&.[](0..2) %>", "form1[0].#subform[3].TelephoneNumber_SecondThreeNumbers[0]": "<%= form.data['veteran_phone']&.gsub('-', '')&.[](3..5) %>", "form1[0].#subform[3].International_Phone_Number_If_Applicable[0]": "<%= nil %>", - "form1[0].#subform[3].Email_Address[0]": "<%= nil %>", + "form1[0].#subform[3].Email_Address[0]": "<%= form.data['veteran_email_address'] %>", "form1[0].#subform[3].CurrentMailingAddress_ZIPOrPostalCode_LastFourNumbers[0]": "<%= nil %>", "form1[0].#subform[3].CurrentMailingAddress_ZIPOrPostalCode_FirstFiveNumbers[0]": "<%= form.data.dig('veteran_mailing_address', 'postal_code') %>", "form1[0].#subform[3].CurrentMailingAddress_Country[0]": "<%= form.data.dig('veteran_mailing_address', 'country') %>", @@ -37,8 +37,8 @@ "form1[0].#subform[3].TelephoneNumber_FirstThreeNumbers[1]": "<%= form.data['non_veteran_phone']&.gsub('-', '')&.[](0..2) %>", "form1[0].#subform[3].TelephoneNumber_SecondThreeNumbers[1]": "<%= form.data['non_veteran_phone']&.gsub('-', '')&.[](3..5) %>", "form1[0].#subform[3].International_Phone_Number_If_Applicable[1]": "<%= nil %>", - "form1[0].#subform[3].VA_File_Number_If_Applicable[0]": "<%= nil %>", - "form1[0].#subform[3].Email_Address[2]": "<%= nil %>", + "form1[0].#subform[3].VA_File_Number_If_Applicable[0]": "<%= form.data.dig('non_veteran_id', 'va_file_number') %>", + "form1[0].#subform[3].Email_Address[2]": "<%= form.data['non_veteran_email_address'] %>", "form1[0].#subform[3].CurrentMailingAddress_ZIPOrPostalCode_LastFourNumbers[1]": "<%= nil %>", "form1[0].#subform[3].CurrentMailingAddress_ZIPOrPostalCode_FirstFiveNumbers[1]": "<%= form.data.dig('non_veteran_mailing_address', 'postal_code') %>", "form1[0].#subform[3].CurrentMailingAddress_Country[1]": "<%= form.data.dig('non_veteran_mailing_address', 'country') %>", @@ -48,7 +48,7 @@ "form1[0].#subform[3].CurrentMailingAddress_NumberAndStreet[1]": "<%= form.data.dig('non_veteran_mailing_address', 'street') %>", "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]": "<%= nil %>", + "form1[0].#subform[3].VA_File_Number_If_Applicable[1]": "<%= form.data.dig('veteran_id', 'va_file_number') %>", "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 %>", @@ -60,13 +60,11 @@ "form1[0].#subform[3].CurrentlyHomeless[0]": "<%= form.data.dig('living_situation', 'none') ? 1 : 0 %>", - "form1[0].#subform[3].Other1[0]": "<%= nil %>", + "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) %>", - "form1[0].#subform[4].Other2[0]": "<%= form.data['other_housing_risks'] %>", - "form1[0].#subform[4].Telephone_Number_Area_Code[0]": "<%= form.data['point_of_contact_phone']&.gsub('-', '')&.[](0..2) %>", "form1[0].#subform[4].Telephone_Middle_Three_Numbers[0]": "<%= form.data['point_of_contact_phone']&.gsub('-', '')&.[](3..5) %>", "form1[0].#subform[4].Telephone_Last_Four_Numbers[0]": "<%= form.data['point_of_contact_phone']&.gsub('-', '')&.[](6..9) %>", @@ -86,12 +84,12 @@ "form1[0].#subform[4].Month[3]": "<%= form.data['pow_confinement_end_date']&.[](5..6) %>", "form1[0].#subform[4].Day[3]": "<%= form.data['pow_confinement_end_date']&.[](8..9) %>", "form1[0].#subform[4].Year[3]": "<%= form.data['pow_confinement_end_date']&.[](0..3) %>", - "form1[0].#subform[4].Month[5]": "<%= form.data['pow_confinement2start_date']&.[](5..6) %>", - "form1[0].#subform[4].Day[5]": "<%= form.data['pow_confinement2start_date']&.[](8..9) %>", - "form1[0].#subform[4].Year[5]": "<%= form.data['pow_confinement2start_date']&.[](0..3) %>", - "form1[0].#subform[4].Month[7]": "<%= form.data['pow_confinement2end_date']&.[](5..6) %>", - "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].Month[5]": "<%= form.data['pow_confinement2_start_date']&.[](5..6) %>", + "form1[0].#subform[4].Day[5]": "<%= form.data['pow_confinement2_start_date']&.[](8..9) %>", + "form1[0].#subform[4].Year[5]": "<%= form.data['pow_confinement2_start_date']&.[](0..3) %>", + "form1[0].#subform[4].Month[7]": "<%= form.data['pow_confinement2_end_date']&.[](5..6) %>", + "form1[0].#subform[4].Day[7]": "<%= form.data['pow_confinement2_end_date']&.[](8..9) %>", + "form1[0].#subform[4].Year[7]": "<%= form.data['pow_confinement2_end_date']&.[](0..3) %>", "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) %>", 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 ff00fb4d991..a324bc267b6 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,7 +12,7 @@ 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)}" if facility end def facility_address(index) @@ -39,12 +39,12 @@ def facility_year(index) end def requester_signature - @data['statement_of_truth_signature'] if @data['preparer_type'] == 'veteran' + @data['statement_of_truth_signature'] if %w[veteran non-veteran].include? @data['preparer_type'] end def third_party_signature - @data['statement_of_truth_signature'] if @data['preparer_type'] != 'veteran' && - @data['third_party_type'] != 'power-of-attorney' + @data['statement_of_truth_signature'] if %w[third-party-veteran + third-party-non-veteran].include? @data['preparer_type'] end def power_of_attorney_signature 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 0f8c643a31c..05ec5f3be90 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 @@ -23,6 +23,7 @@ "postal_code": "12345" }, "veteran_phone": "1234567890", + "veteran_email_address": "email@vet.com", "other_reasons": { "financial_hardship": true, "als": true, diff --git a/modules/simple_forms_api/spec/models/vba_20_10207_spec.rb b/modules/simple_forms_api/spec/models/vba_20_10207_spec.rb index 66f60b88e33..02e96f258a1 100644 --- a/modules/simple_forms_api/spec/models/vba_20_10207_spec.rb +++ b/modules/simple_forms_api/spec/models/vba_20_10207_spec.rb @@ -51,7 +51,7 @@ statement_of_truth_signature = 'John Veteran' [ { preparer_type: 'veteran', third_party_type: nil, expected: statement_of_truth_signature }, - { preparer_type: 'non-veteran', third_party_type: nil, expected: nil }, + { preparer_type: 'non-veteran', third_party_type: nil, expected: statement_of_truth_signature }, { preparer_type: 'third-party-non-veteran', third_party_type: 'representative', expected: nil }, { preparer_type: 'third-party-veteran', third_party_type: 'representative', expected: nil }, { preparer_type: 'third-party-non-veteran', third_party_type: 'power-of-attorney', expected: nil } @@ -78,12 +78,13 @@ statement_of_truth_signature = 'John Veteran' [ { preparer_type: 'veteran', third_party_type: nil, expected: nil }, - { preparer_type: 'non-veteran', third_party_type: nil, expected: statement_of_truth_signature }, + { preparer_type: 'non-veteran', third_party_type: nil, expected: nil }, { preparer_type: 'third-party-non-veteran', third_party_type: 'representative', expected: statement_of_truth_signature }, { preparer_type: 'third-party-veteran', third_party_type: 'representative', expected: statement_of_truth_signature }, - { preparer_type: 'third-party-non-veteran', third_party_type: 'power-of-attorney', expected: nil } + { preparer_type: 'third-party-non-veteran', third_party_type: 'power-of-attorney', + expected: statement_of_truth_signature } ].each do |data| preparer_type = data[:preparer_type] third_party_type = data[:third_party_type]