Skip to content

Commit

Permalink
Adapt hpo_id phenotype filter table to be a wildcard filter
Browse files Browse the repository at this point in the history
  • Loading branch information
susannasiebert committed May 20, 2024
1 parent 91d0233 commit ebb1aa0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/app/graphql/resolvers/phenotypes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ebb1aa0

Please sign in to comment.