From ebb1aa0c6bbb8ed04e2e3d25cafda06043132d96 Mon Sep 17 00:00:00 2001 From: Susanna Kiwala Date: Mon, 20 May 2024 10:35:41 -0500 Subject: [PATCH] Adapt hpo_id phenotype filter table to be a wildcard filter --- server/app/graphql/resolvers/phenotypes.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/app/graphql/resolvers/phenotypes.rb b/server/app/graphql/resolvers/phenotypes.rb index ce443fdfb..06d42e835 100644 --- a/server/app/graphql/resolvers/phenotypes.rb +++ b/server/app/graphql/resolvers/phenotypes.rb @@ -17,12 +17,12 @@ class Resolvers::Phenotypes < GraphQL::Schema::Resolver .having('COUNT(evidence_items.id) > 0 OR COUNT(assertions.id) > 0') .order('evidence_count DESC') end - + option(:hpo_id, type: String, description: 'Limit to phenotypes with a specific HPO ID') do |scope, value| if value.upcase.starts_with?('HP:') - scope.where(hpo_id: value.upcase) + scope.where('hpo_id ILIKE ?', "#{value}%") else - scope.where(hpo_id: "HP:#{value}") + scope.where('hpo_id ILIKE ?', "HP:#{value}%") end end