Skip to content

Commit

Permalink
Fix bug whereby note without a type caused an error on export
Browse files Browse the repository at this point in the history
  • Loading branch information
payten committed May 20, 2022
1 parent 2350cef commit b8e343f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/model/spreadsheet_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def calculate_subrecord_counts(min_subrecords, extra_subrecords, min_notes)
.select(:archival_object_id, :notes)
.each do |row|
note_json = JSON.parse(row[:notes])
note_type = note_json.fetch('type')
note_type = note_json.fetch('type', 'NOT_SUPPORTED')

notes_max_counts[note_type] ||= 0
notes_max_counts[note_type] += 1
Expand Down Expand Up @@ -685,7 +685,7 @@ def dataset_iterator(&block)
.each do |row|
note_json = ASUtils.json_parse(row[:notes])

note_type = note_json.fetch('type').intern
note_type = note_json.fetch('type', 'NOT_SUPPORTED').intern

next unless (MULTIPART_NOTES_OF_INTEREST + SINGLEPART_NOTES_OF_INTEREST).include?(note_type)
next unless selected?("note_#{note_type}")
Expand Down

0 comments on commit b8e343f

Please sign in to comment.