Files
docuseal/lib/flows.rb
T
Alex Turchyn 97c462ead2 initial commit
2023-06-01 00:00:58 +03:00

21 lines
374 B
Ruby

# frozen_string_literal: true
module Flows
module_function
def build_field_areas_index(flow)
hash = {}
flow.fields.each do |field|
(field['areas'] || []).each do |area|
hash[area['attachment_uuid']] ||= {}
acc = (hash[area['attachment_uuid']][area['page']] ||= [])
acc << { area:, field: }
end
end
hash
end
end