def compact_results(items)
      items.map do |subtest|
        subtests = subtest[:subtests]
        if subtests.size > 1
          subtests
        elsif subtests.size == 1
          compact_results(subtests)
        end
      end.flatten.compact
    end
def compact_results(items)
      items.map do |subtest|
        subtests = subtest[:subtests]
        if subtests.size > 1
          subtests
        elsif subtests.size == 1
          compact_results(subtests)
        end
      end.flatten.compact
    end
def compact_results ( items ) items . map do | subtest | subtests = subtest [ :subtests ] if subtests . size > 1 subtests elsif subtests . size == 1 compact_results ( subtests ) end end . flatten . compact end
This method simplify results structure,
 it sets only one level of nesting
 by leaving parents only with collection as child
This method simplify results structure it sets only one level of nesting by leaving parents only with collection as child