Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Burials] Location of Death update #20909

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ GIT

GIT
remote: https://github.com/department-of-veterans-affairs/vets-json-schema
revision: bdd9c4e3b6fd786798b3254be7af341add314722
revision: 34b767b6cf27abc7f33213abbfcb13238afd58de
branch: master
specs:
vets_json_schema (24.7.5)
vets_json_schema (24.8.1)
multi_json (~> 1.0)
script_utils (= 0.0.4)

Expand Down
9 changes: 6 additions & 3 deletions modules/burials/lib/pdf_fill/forms/va21p530ez.rb
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,15 @@ def convert_location_of_death
location_of_death = @form_data['locationOfDeath']
return if location_of_death.blank?

if location_of_death[location_of_death['location']].present? && location_of_death['location'] != 'other'
options = location_of_death[location_of_death['location']]
location = location_of_death['location']
options = location_of_death[location] || @form_data[location]
if options.present? && location != 'other'
location_of_death['placeAndLocation'] = "#{options['facilityName']} - #{options['facilityLocation']}"
end

location_of_death['location'] = 'nursingHomeUnpaid' if location_of_death['location'] == 'atHome'
@form_data.delete(location)

location_of_death['location'] = 'nursingHomeUnpaid' if location == 'atHome'

expand_checkbox_as_hash(@form_data['locationOfDeath'], 'location')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"placeOfSeparation":"placeofentry56",
"rank":"gradeofentry56",
"unit":"unit"}],
"locationOfDeath":{"location":"other", "other":"other place"},
"locationOfDeath":{"location":"nursingHomePaid"},
"nursingHomePaid":{"facilityName":"Best Nursing Home","facilityLocation":"portland, ME"},
"deathDate":"2024-01-01",
"burialDate":"2024-01-02",
"veteranFullName":{"first":"veteran", "middle":"middle", "last":"lastname", "suffix":"Jr."},
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
],
"locationOfDeath":
{
"location":"other",
"other":"other place",
"checkbox":{"other":"On"}
"location":"nursingHomePaid",
"placeAndLocation": "Best Nursing Home - portland, ME",
"checkbox":{"nursingHomePaid":"On"}
},
"deathDate":{"month":"01", "day":"01", "year":"2024"},
"burialDate":{"month":"01", "day":"02", "year":"2024"},
Expand Down
20 changes: 20 additions & 0 deletions modules/burials/spec/lib/pdf_fill/forms/va21p530ez_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,26 @@ def class_form_data
end
end

context 'with a regular location of death in new format' do
let(:form_data) do
{
'locationOfDeath' => {
'location' => 'nursingHomeUnpaid'
},
'nursingHomeUnpaid' => {
'facilityName' => 'facility name',
'facilityLocation' => 'Washington, DC'
}
}
end

it 'returns the directly mapped location' do
subject
expect(class_form_data['locationOfDeath']['checkbox']).to eq({ 'nursingHomeUnpaid' => 'On' })
expect(class_form_data['locationOfDeath']['placeAndLocation']).to eq('facility name - Washington, DC')
end
end

context 'with a location needed for translation' do
let(:form_data) do
{
Expand Down
Loading