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 d08f4ae1a22..a12c86a7ab2 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,29 @@ "form1[0].#subform[3].Email_Address[3]": "<%= nil %>", "form1[0].#subform[3].VA_File_Number_If_Applicable[1]": "<%= nil %>", - "form1[0].#subform[3].CurrentlyHomeless[0]": "<%= form.currently_homeless? ? 0 : 1 %>", - "form1[0].#subform[3].HomelessLivingSituation[0]": "<%= form.homeless_living_situation %>", + "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].Other1[0]": "<%= nil %>", "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].RadioButtonList[0]": "<%= form.at_risk_of_being_homeless? ? 0 : 1 %>", - "form1[0].#subform[4].RadioButtonList[1]": "<%= form.risk_homeless_living_situation %>", + "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) %>", + "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 %>", 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 5a3d5ee8fed..5401691a3cf 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 @@ -10,34 +10,6 @@ def initialize(data) @data = data end - def currently_homeless? - (0..2).include? homeless_living_situation - end - - def homeless_living_situation - if @data['living_situation']['SHELTER'] - 0 - elsif @data['living_situation']['FRIEND_OR_FAMILY'] - 1 - elsif @data['living_situation']['OVERNIGHT'] - 2 - end - end - - def at_risk_of_being_homeless? - (0..2).include? risk_homeless_living_situation - end - - def risk_homeless_living_situation - if @data['living_situation']['LOSING_HOME'] - 0 - elsif @data['living_situation']['LEAVING_SHELTER'] - 1 - elsif @data['living_situation']['OTHER_RISK'] - 2 - end - end - def facility_name(index) facility = @data['medical_treatments']&.[](index - 1) "#{facility&.[]('facility_name')}\n#{facility_address(index)}" 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 8a573d0c27e..2f22efb67a4 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 @@ -29,7 +29,8 @@ "TERMINAL_ILLNESS": true, "VSI_SI": true, "FORMER_POW": true, - "MEDAL_AWARD": true + "MEDAL_AWARD": true, + "OVER_85": true }, "pow_confinement_start_date": "2018-01-01", "pow_confinement_end_date": "2018-02-03", @@ -60,5 +61,7 @@ "start_date": "2013-01-06" } ], + "point_of_contact_name": "Pointy McPointersons", + "point_of_contact_phone": "098-765-4321", "statement_of_truth_signature": "John Veteran" } \ No newline at end of file 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 b72abaa27e3..66f60b88e33 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 @@ -47,110 +47,6 @@ end end - describe 'currently_homeless?' do - it 'returns true when the preparer is homeless' do - data = { 'living_situation' => { 'SHELTER' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.currently_homeless?).to eq(true) - end - - it 'returns false when the preparer is not homeless' do - data = { 'living_situation' => {} } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.currently_homeless?).to eq(false) - end - end - - describe 'homeless_living_situation' do - it 'returns 0 when the preparer is in a shelter' do - data = { 'living_situation' => { 'SHELTER' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.homeless_living_situation).to eq(0) - end - - it 'returns 1 when the preparer is with a friend or family' do - data = { 'living_situation' => { 'FRIEND_OR_FAMILY' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.homeless_living_situation).to eq(1) - end - - it 'returns 2 when the preparer is in an overnight place' do - data = { 'living_situation' => { 'OVERNIGHT' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.homeless_living_situation).to eq(2) - end - - it 'returns nil when the preparer is not homeless' do - data = { 'living_situation' => {} } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.homeless_living_situation).to eq(nil) - end - end - - describe 'at_risk_of_being_homeless?' do - it 'returns true when the preparer is at risk of being homeless' do - data = { 'living_situation' => { 'LOSING_HOME' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.at_risk_of_being_homeless?).to eq(true) - end - - it 'returns false when the preparer is not at risk of being homeless' do - data = { 'living_situation' => {} } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.at_risk_of_being_homeless?).to eq(false) - end - end - - describe 'risk_homeless_living_situation' do - it 'returns 0 when the preparer is losing their home' do - data = { 'living_situation' => { 'LOSING_HOME' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.risk_homeless_living_situation).to eq(0) - end - - it 'returns 1 when the preparer is leaving a shelter' do - data = { 'living_situation' => { 'LEAVING_SHELTER' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.risk_homeless_living_situation).to eq(1) - end - - it 'returns 2 when the preparer is experiencing another risk' do - data = { 'living_situation' => { 'OTHER_RISK' => true } } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.risk_homeless_living_situation).to eq(2) - end - - it 'returns nil when the preparer is not at risk of being homeless' do - data = { 'living_situation' => {} } - - form = SimpleFormsApi::VBA2010207.new(data) - - expect(form.risk_homeless_living_situation).to eq(nil) - end - end - describe 'requester_signature' do statement_of_truth_signature = 'John Veteran' [ diff --git a/modules/simple_forms_api/templates/vba_20_10207.pdf b/modules/simple_forms_api/templates/vba_20_10207.pdf index cbb3b1a7575..d8aa12c3a2c 100644 Binary files a/modules/simple_forms_api/templates/vba_20_10207.pdf and b/modules/simple_forms_api/templates/vba_20_10207.pdf differ