diff --git a/app/controllers/concerns/facetable.rb b/app/controllers/concerns/facetable.rb index a3717e7ad..abe46157b 100644 --- a/app/controllers/concerns/facetable.rb +++ b/app/controllers/concerns/facetable.rb @@ -262,7 +262,7 @@ def facet_by_registrants(arr) end def providers_totals(arr) - providers = Provider.all.pluck(:symbol, :name).to_h + providers = Provider.unscoped.where("allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR')").where(deleted_at: nil).pluck(:symbol, :name).to_h arr.map do |hsh| { "id" => hsh["key"], diff --git a/spec/requests/providers_spec.rb b/spec/requests/providers_spec.rb index fd069202f..2859767f4 100644 --- a/spec/requests/providers_spec.rb +++ b/spec/requests/providers_spec.rb @@ -126,6 +126,7 @@ describe 'GET /providers/totals' do let(:provider) { create(:provider) } + let(:ra) { create(:provider, role_name: "ROLE_REGISTRATION_AGENCY") } let(:client) { create(:client, provider: provider) } let!(:prefixes) { create_list(:prefix, 10) } let!(:dois) { create_list(:doi, 3, client: client, aasm_state: "findable") }