- # fetch children of all the active crs in one call, if there are any
- active_crs = recent_crs.each {|cr| cr if (cr.priority.andand > 0 and cr.state != 'Final' and cr.container_uuid)}
- active_cr_uuids = active_crs.map(&:uuid)
- active_cr_containers = active_crs.map {|cr| cr.container_uuid}.compact.uniq
- cr_children = {}
- if active_cr_containers.any?
- active_cr_containers.each { |c| cr_children[c] = []}
- cols = ContainerRequest.columns.map(&:name) - %w(id updated_at mounts)
- reqs = ContainerRequest.select(cols).where(requesting_container_uuid: active_cr_containers).results
- reqs.each {|cr| cr_children[cr.requesting_container_uuid] << cr} if reqs
- end
-