Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
acoffman committed Oct 2, 2024
2 parents b52fbe7 + de08b87 commit a6491d9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion server/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ gem 'rails', '~> 7.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.1'
# Use Puma as the app server
gem 'puma', '5.6.8'
gem 'puma', '5.6.9'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
Expand Down
6 changes: 3 additions & 3 deletions server/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ GEM
net-smtp (0.4.0.1)
net-protocol
net-ssh (7.2.1)
nio4r (2.7.0)
nio4r (2.7.3)
nokogiri (1.16.5-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.5-arm-linux)
Expand Down Expand Up @@ -330,7 +330,7 @@ GEM
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (5.6.8)
puma (5.6.9)
nio4r (~> 2.0)
raabro (1.4.0)
racc (1.8.0)
Expand Down Expand Up @@ -579,7 +579,7 @@ DEPENDENCIES
pg (~> 1.1)
pry
pry-rails
puma (= 5.6.8)
puma (= 5.6.9)
rack-cors (~> 1.1.1)
rack-mini-profiler (~> 2.0)
rails (~> 7.1)
Expand Down
12 changes: 6 additions & 6 deletions server/app/graphql/types/queries/typeahead_queries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ def disease_typeahead(query_term:)
base_query = Disease.where(deprecated: false)
results = base_query.where("diseases.name ILIKE ?", "%#{query_term}%")
.or(base_query.where("diseases.doid ILIKE ?", "#{query_term}%"))
.order("LENGTH(diseases.name) ASC")
#.order("LENGTH(diseases.name) ASC")
.limit(10)
if results.size < 10
secondary_results = base_query.eager_load(:disease_aliases)
.where("disease_aliases.name ILIKE ?", "%#{query_term}%")
.where.not(id: results.select('id'))
.order("LENGTH(diseases.name) ASC")
#.order("LENGTH(diseases.name) ASC")
.distinct
.limit(10-results.size)
return results + secondary_results
Expand All @@ -100,7 +100,7 @@ def therapy_typeahead(query_term:)
base_query = Therapy.where(deprecated: false)
results = base_query.where("therapies.name ILIKE ?", "#{query_term}%")
.or(base_query.where("therapies.ncit_id ILIKE ?", "%#{query_term}%"))
.order("LENGTH(therapies.name) ASC")
#.order("LENGTH(therapies.name) ASC")
.limit(10)
if results.size < 10
secondary_results = base_query.where('therapies.name ILIKE ?', "%#{query_term}%")
Expand All @@ -110,7 +110,7 @@ def therapy_typeahead(query_term:)
tertiary_results = base_query.eager_load(:therapy_aliases)
.where("therapy_aliases.name ILIKE ?", "%#{query_term}%")
.where.not(id: results.select('id') + secondary_results.select('id'))
.order("LENGTH(therapies.name) ASC")
#.order("LENGTH(therapies.name) ASC")
.distinct
.limit(10-results.size)

Expand All @@ -131,14 +131,14 @@ def feature_typeahead(query_term:, feature_type: nil)
end

results = base_query.where('features.name ILIKE ?', "#{query_term}%")
.order("LENGTH(features.name) ASC")
#.order("LENGTH(features.name) ASC")
.limit(10)

if results.size < 10
secondary_results = base_query.eager_load(:feature_aliases)
.where("feature_aliases.name ILIKE ?", "#{query_term}%")
.where.not(id: results.select('id'))
.order("LENGTH(features.name) ASC")
#.order("LENGTH(features.name) ASC")
.distinct
.limit(10 - results.size)
return (results + secondary_results).uniq
Expand Down
2 changes: 1 addition & 1 deletion server/app/graphql/types/variants/gene_variant_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def mane_select_transcript
def open_revision_count
Loaders::AssociationCountLoader.for(object.class, association: :open_revisions).load(object.id).then do |count|
Loaders::AssociationLoader.for(Variants::GeneVariant, :coordinates).load(object).then do |coord|
Loaders::AssociationCountLoader.for(VariantCoordinate, association: :open_revisions).load(coord.id) do |coord_count|
Loaders::AssociationCountLoader.for(VariantCoordinate, association: :open_revisions).load(coord.id).then do |coord_count|
count + coord_count
end
end
Expand Down
10 changes: 10 additions & 0 deletions server/app/models/activities/create_variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@ def call_actions

@variant = cmd.variant
@molecular_profile = cmd.molecular_profile

stub_coordinates
variant.save!

events << cmd.events
end

def stub_coordinates
if variant.type == 'Variants::GeneVariant'
variant.coordinates = VariantCoordinate.generate_stub(variant, 'Gene Variant Coordinate')
end
end

def linked_entities
molecular_profile
end
Expand Down

0 comments on commit a6491d9

Please sign in to comment.