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 4, 2023
2 parents eb9ba18 + dc155fe commit ad5dad3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/publish_headless_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./server
file: Dockerfile-headless
file: ./server/Dockerfile-headless
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 4 additions & 0 deletions server/app/admin/therapies_admin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
scope :all, default: true
scope :without_ncit_id, -> { Therapy.where(ncit_id: nil) }

search do |q|
q ? collection.where("name ILIKE ? OR ncit_id ILIKE ?", "%#{q}%", "%#{q}%") : collection
end

# Customize the table columns shown on the index view.
table do
column :id
Expand Down
11 changes: 3 additions & 8 deletions server/app/models/input_adaptors/evidence_item_input_adaptor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ def self.check_input_for_errors(evidence_input_object: )
query_fields.delete(:phenotype_ids)

eid_query = EvidenceItem.where(query_fields)
if fields.phenotype_ids.any?
eid_query = eid_query.joins(:phenotypes).where("phenotypes.id" => fields.phenotype_ids)
end

if fields.therapy_ids.any?
eid_query = eid_query.joins(:therapies).where("therapies.id" => fields.therapy_ids)
end

if eid = eid_query.first
errors << "Existing identical Evidence Item found: EID#{eid.id}"
if eid.therapy_ids.sort == fields.therapy_ids.sort && eid.phenotype_ids.sort == fields.phenotype_ids.sort
errors << "Existing identical Evidence Item found: EID#{eid.id}"
end
end

existing_phenotype_ids = Phenotype.where(id: fields.phenotype_ids).pluck(:id)
Expand Down
2 changes: 2 additions & 0 deletions server/app/models/therapy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class Therapy < ApplicationRecord
has_and_belongs_to_many :assertions
has_and_belongs_to_many :therapy_aliases

validates :ncit_id, uniqueness: true

def self.url_for(ncit_id:)
if ncit_id.nil?
nil
Expand Down

0 comments on commit ad5dad3

Please sign in to comment.