Skip to content

Commit 32f7a57

Browse files
authored
In 0781, overflow Other reports as separate checkboxes (#22110)
1 parent 065236f commit 32f7a57

6 files changed

Lines changed: 16 additions & 5 deletions

File tree

lib/pdf_fill/filler.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def process_form(form_id, form_data, form_class, file_name_extension, fill_optio
167167
if fill_options.fetch(:extras_redesign, false) && submit_date.present?
168168
file_path = stamp_form(file_path, submit_date)
169169
end
170-
combine_extras(file_path, hash_converter.extras_generator)
170+
output = combine_extras(file_path, hash_converter.extras_generator)
171+
Rails.logger.info('PdfFill done', fill_options.merge(form_id:, file_name_extension:, extras: output != file_path))
172+
output
171173
end
172174

173175
def make_hash_converter(form_id, form_class, submit_date, fill_options)

lib/pdf_fill/forms/va210781v2.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,13 +342,14 @@ class Va210781v2 < FormBase
342342
question_num: 11,
343343
question_suffix: 'B',
344344
question_label: 'Other',
345-
question_type: 'checklist_group',
346345
question_text: 'Other Report'
347346
},
348347
'otherOverflow' => {
349348
key: '',
350349
question_num: 11,
351350
question_suffix: 'B',
351+
question_label: 'Other',
352+
question_type: 'checklist_group',
352353
question_text: 'Other Report'
353354
}
354355
},
@@ -716,7 +717,7 @@ def process_reports(extras_redesign: false)
716717
no_report = false
717718
police_reports = []
718719
unlisted_reports = []
719-
reports_details = @form_data['reportsDetails'] ||= {}
720+
@form_data['reportsDetails'] ||= {}
720721

721722
@form_data['events'].each do |event|
722723
reports = merge_reports(event)
@@ -738,7 +739,7 @@ def process_reports(extras_redesign: false)
738739
@form_data['noReportFiled'] = no_report && !report_filed ? 1 : nil
739740

740741
process_police_reports(police_reports, extras_redesign)
741-
reports_details['other'] = unlisted_reports.join('; ') unless unlisted_reports.empty?
742+
process_unlisted_reports(unlisted_reports, extras_redesign)
742743
end
743744

744745
def process_police_reports(police_reports, extras_redesign)
@@ -754,6 +755,13 @@ def process_police_reports(police_reports, extras_redesign)
754755
end
755756
end
756757

758+
def process_unlisted_reports(unlisted_reports, extras_redesign)
759+
return if unlisted_reports.empty?
760+
761+
@form_data['reportsDetails']['other'] = unlisted_reports.join('; ')
762+
@form_data['reportsDetails']['otherOverflow'] = unlisted_reports if extras_redesign
763+
end
764+
757765
def process_treatment_dates
758766
@form_data['treatmentProvidersDetails']&.each do |item|
759767
item['noDates'] = item['treatmentMonth'].to_s.strip.empty? && item['treatmentYear'].to_s.strip.empty?

spec/fixtures/pdf_fill/21-0781V2/overflow.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"city": "Dalworthington Gardens",
3030
"state": "TX",
3131
"township": "",
32-
"country": "USA"
32+
"country": "USA",
33+
"unlistedReport": "incident report"
3334
},
3435
{
3536
"details": "Mugged",
159 Bytes
Binary file not shown.
4.19 KB
Binary file not shown.
196 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)