Skip to content

Commit

Permalink
[Automated] Merged master into target k8s
Browse files Browse the repository at this point in the history
  • Loading branch information
va-vsp-bot authored Apr 9, 2024
2 parents c0ed718 + 39be96c commit 1871d4a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
29 changes: 22 additions & 7 deletions lib/pdf_fill/forms/va21p530v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,17 @@ class Va21p530v2 < FormBase
},
'rank' => {
key: "form1[0].#subform[82].GRADE_RANK_OR_RATING[#{ITERATOR}]",
question_num: 11,
question_num: 14,
question_suffix: 'D',
question_text: 'GRADE, RANK OR RATING, ORGANIZATION AND BRANCH OF SERVICE',
limit: 31
},
'unit' => {
key: "form1[0].#subform[82].GRADE_RANK_OR_RATING_UNIT[#{ITERATOR}]",
question_num: 14,
question_suffix: 'D',
question_text: 'UNIT',
limit: 0
}
},
'previousNames' => {
Expand Down Expand Up @@ -525,10 +532,15 @@ class Va21p530v2 < FormBase
}.freeze
# rubocop:enable Layout/LineLength

def sanitize_phone(phone)
phone.gsub('-', '')
end

def split_phone(hash, key)
phone = hash[key]
return if phone.blank?

phone = sanitize_phone(phone)
hash[key] = {
'first' => phone[0..2],
'second' => phone[3..5],
Expand Down Expand Up @@ -683,13 +695,16 @@ def merge_fields(_options = {})
'other' => select_checkbox(relationship_to_veteran == 'other')
}

# special case for transportation being the only option selected.
final_resting_place = @form_data.dig('finalRestingPlace', 'location')
@form_data['finalRestingPlace']['location'] = {
'cemetery' => select_checkbox(final_resting_place == 'cemetery'),
'privateResidence' => select_checkbox(final_resting_place == 'privateResidence'),
'mausoleum' => select_checkbox(final_resting_place == 'mausoleum'),
'other' => select_checkbox(final_resting_place == 'other')
}
if final_resting_place.present?
@form_data['finalRestingPlace']['location'] = {
'cemetery' => select_checkbox(final_resting_place == 'cemetery'),
'privateResidence' => select_checkbox(final_resting_place == 'privateResidence'),
'mausoleum' => select_checkbox(final_resting_place == 'mausoleum'),
'other' => select_checkbox(final_resting_place == 'other')
}
end

expand_cemetery_location

Expand Down
7 changes: 7 additions & 0 deletions spec/lib/pdf_fill/forms/va21p530v2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ def class_form_data
:phone
],
{ 'first' => '111', 'second' => '222', 'third' => '3333' }
],
[
[
{ phone: '111-222-3333' },
:phone
],
{ 'first' => '111', 'second' => '222', 'third' => '3333' }
]
]
)
Expand Down

0 comments on commit 1871d4a

Please sign in to comment.