From c80cf20bf069dbf5a0aada04e3b97531a395f0b3 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Thu, 15 Apr 2021 22:03:51 +0200 Subject: [PATCH] filter by has_required_contacts status --- app/controllers/providers_controller.rb | 1 + app/controllers/v3/providers_controller.rb | 1 + app/models/concerns/indexable.rb | 3 +++ 3 files changed, 5 insertions(+) diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb index be93e981e..16db87f2e 100644 --- a/app/controllers/providers_controller.rb +++ b/app/controllers/providers_controller.rb @@ -44,6 +44,7 @@ def index organization_type: params[:organization_type], focus_area: params[:focus_area], non_profit_status: params[:non_profit_status], + has_required_contacts: params[:has_required_contacts], include_deleted: params[:include_deleted], page: page, sort: sort, diff --git a/app/controllers/v3/providers_controller.rb b/app/controllers/v3/providers_controller.rb index 2115ce804..c5309a2d3 100644 --- a/app/controllers/v3/providers_controller.rb +++ b/app/controllers/v3/providers_controller.rb @@ -44,6 +44,7 @@ def index organization_type: params[:organization_type], focus_area: params[:focus_area], non_profit_status: params[:non_profit_status], + has_required_contacts: params[:has_required_contacts], page: page, sort: sort, ) diff --git a/app/models/concerns/indexable.rb b/app/models/concerns/indexable.rb index a2153f43a..8542dfc5b 100644 --- a/app/models/concerns/indexable.rb +++ b/app/models/concerns/indexable.rb @@ -328,6 +328,9 @@ def query(query, options = {}) if options[:non_profit_status].present? filter << { term: { non_profit_status: options[:non_profit_status] } } end + if options[:has_required_contacts].present? + filter << { term: { has_required_contacts: options[:has_required_contacts] } } + end if options[:focus_area].present? filter << { terms: { focus_area: options[:focus_area].split(",") } } end