These are chat archives for ManageIQ/manageiq/performance

8th
Mar 2018
Keenan Brock
@kbrock
Mar 08 2018 20:45

Starting to get frustrated when I see

          vms = Vm.find_tagged_with(:all => @options[:tag], :ns => '*')
          vms &= @report_user.accessible_vms if @report_user && @report_user.self_service?
          vms

The whole, make one query, then make another query to join together

because I assume that we'll run that through rbac, which will take all the ids and send them back to the server to filter them down again
I worked really hard to get find_tagged_with to be a scope. no small feat
and then when you see query.to_a + query2.to_a ... :(

hmm. maybe the second line could be:

vms = vms.where(:id => @report_user.accessible_vms) if @report_user && @report_user.self_service?

... @report_user.&self_service?

hmm. I'm repeating myself ^ -- guess a sign that it frustrates me a lot