Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fusion bugfixes #1119

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading