Don't wrap arrays twice: `children` are already wrapped in an array

We do the wrapping in an array in represent_hierarchy for children.
This commit is contained in:
Bob Van Landuyt 2017-09-22 15:34:22 +02:00
parent e13753fcaa
commit ee2744c60d
1 changed files with 2 additions and 2 deletions

View File

@ -27,8 +27,8 @@ class GroupChildSerializer < BaseSerializer
if children.is_a?(GroupDescendant)
represent_hierarchy(children.hierarchy(hierarchy_root), opts).first
else
hierarchies = Array.wrap(GroupDescendant.merge_hierarchies(children, hierarchy_root))
hierarchies.map { |hierarchy| represent_hierarchy(hierarchy, opts) }.flatten
hierarchies = GroupDescendant.merge_hierarchies(children, hierarchy_root)
represent_hierarchy(hierarchies, opts)
end
end