Skip to content

Commit

Permalink
Fix Admin console source creation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
susannasiebert committed Feb 18, 2019
1 parent df5689c commit d8f33e3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/admin/utilities.rb
Expand Up @@ -150,13 +150,20 @@
"No Source Type provided."
elsif (source = Source.find_by(citation_id: proposed_citation_id, source_type: proposed_source_type_int))
"Source '#{source.description}' already present."
elsif proposed_source_type == 'pubmed'
elsif proposed_source_type == 'PubMed'
if (citation = Scrapers::PubMed.get_citation_from_pubmed_id(proposed_citation_id)).present?
Source.create(citation_id: proposed_citation_id, description: citation, source_type: proposed_source_type)
"Source '#{citation}' added to CIViC."
else
"Source with PubMed Id #{proposed_citation_id} not found or PubMed is unreachable."
end
elsif proposed_source_type == 'ASCO'
if (citation = Scrapers::Asco.get_citation_from_asco_id(proposed_citation_id)).present?
Source.create(citation_id: proposed_citation_id, description: citation, source_type: proposed_source_type)
"Source '#{citation}' added to CIViC."
else
"Source with ASCO Id #{proposed_citation_id} not found or ASCO is unreachable."
end
else
"Source type not supported."
end
Expand Down

0 comments on commit d8f33e3

Please sign in to comment.