From c8a56a68658ee68cea9777e5e05ad7af20bc15ac Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Fri, 24 May 2019 12:14:36 +0200 Subject: [PATCH] always show all members in providers api. datacite/datacite#725 --- app/controllers/members_controller.rb | 2 +- app/controllers/providers_controller.rb | 2 +- app/models/concerns/indexable.rb | 7 +------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index 67a2a8c3b..28c1dcd36 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -18,7 +18,7 @@ def index elsif params[:ids].present? response = Provider.find_by_id(params[:ids], page: page, sort: sort) else - response = Provider.query(params[:query], all_members: true, year: params[:year], region: params[:region], organization_type: params[:organization_type], focus_area: params[:focus_area], fields: params[:fields], page: page, sort: sort) + response = Provider.query(params[:query], year: params[:year], region: params[:region], organization_type: params[:organization_type], focus_area: params[:focus_area], fields: params[:fields], page: page, sort: sort) end begin diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb index c4b09cac8..969e3572e 100644 --- a/app/controllers/providers_controller.rb +++ b/app/controllers/providers_controller.rb @@ -25,7 +25,7 @@ def index elsif params[:ids].present? response = Provider.find_by_id(params[:ids], page: page, sort: sort) else - response = Provider.query(params[:query], year: params[:year], region: params[:region], organization_type: params[:organization_type], focus_area: params[:focus_area], all_members: params[:all_members], page: page, sort: sort) + response = Provider.query(params[:query], year: params[:year], region: params[:region], organization_type: params[:organization_type], focus_area: params[:focus_area], page: page, sort: sort) end begin diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index f3afccffa..d6cbca044 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -163,12 +163,7 @@ def query(query, options={}) must << { term: { region: options[:region].upcase }} if options[:region].present? must << { term: { organization_type: options[:organization_type] }} if options[:organization_type].present? must << { term: { focus_area: options[:focus_area] }} if options[:focus_area].present? - - if options[:all_members] - must << { terms: { role_name: %w( ROLE_FOR_PROFIT_PROVIDER ROLE_CONTRACTUAL_PROVIDER ROLE_CONSORTIUM_LEAD ROLE_ALLOCATOR ROLE_MEMBER) }} - else - must << { terms: { role_name: %w( ROLE_FOR_PROFIT_PROVIDER ROLE_CONTRACTUAL_PROVIDER ROLE_CONSORTIUM_LEAD ROLE_ALLOCATOR) }} - end + must << { terms: { role_name: %w( ROLE_FOR_PROFIT_PROVIDER ROLE_CONTRACTUAL_PROVIDER ROLE_CONSORTIUM_LEAD ROLE_ALLOCATOR ROLE_MEMBER) }} must_not << { exists: { field: "deleted_at" }} unless options[:include_deleted] elsif self.name == "Client"