File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -5,27 +5,28 @@ def initialize(permission_queryer)
5
5
end
6
6
7
7
def fetch_orgs ( service_plan_guids :)
8
- orgs_query ( service_plan_guids :) . all
8
+ base_query ( service_plan_guids :) .
9
+ select_all ( :organizations ) .
10
+ distinct ( :organizations__id ) .
11
+ order_by ( :id ) .
12
+ all
9
13
end
10
14
11
15
def any_orgs? ( service_plan_guids :)
12
- orgs_query ( service_plan_guids :) . any?
16
+ base_query ( service_plan_guids :) . any?
13
17
end
14
18
15
19
private
16
20
17
- def orgs_query ( service_plan_guids :)
21
+ def base_query ( service_plan_guids :)
18
22
dataset = Organization . dataset .
19
23
join ( :service_plan_visibilities , organization_id : :organizations__id ) .
20
24
join ( :service_plans , id : :service_plan_visibilities__service_plan_id ) .
21
25
where ( service_plans__guid : service_plan_guids )
22
26
23
27
dataset = dataset . where ( organizations__guid : @permission_queryer . readable_org_guids_query ) unless @permission_queryer . can_read_globally?
24
28
25
- dataset .
26
- select_all ( :organizations ) .
27
- distinct ( :organizations__id ) .
28
- order_by ( :id )
29
+ dataset
29
30
end
30
31
end
31
32
end
You can’t perform that action at this time.
0 commit comments