Module: Ecoportal::API::GraphQL::Helpers::LocationsTree
- Included in:
- Interface::LocationStructure::Nodes
- Defined in:
- lib/ecoportal/api/graphql/helpers/locations_tree.rb
Constant Summary collapse
- RELEVANT_NODES_COUNT =
1_000
Instance Method Summary collapse
Instance Method Details
#treeify(nodes) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/ecoportal/api/graphql/helpers/locations_tree.rb', line 8 def treeify(nodes) parents = nodes.each_with_object({}) do |node, out| (out[node.parent_id_upcase] ||= []).push(node) end get_children(nil, parents) end |