Skip to content

Commit

Permalink
DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Feb 5, 2024
1 parent 67decac commit 992e410
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/models/concerns/has_edam_terms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ module HasEdamTerms
extend ActiveSupport::Concern

def scientific_topics_and_synonyms
scientific_topics.map do |term|
[term.preferred_label] + term.has_exact_synonym + term.has_narrow_synonym
end.flatten.uniq
edam_term_names_and_synonyms(scientific_topics)
end

def operations_and_synonyms
operations.map do |term|
edam_term_names_and_synonyms(operations)
end

private

def edam_term_names_and_synonyms(terms)
terms.map do |term|
[term.preferred_label] + term.has_exact_synonym + term.has_narrow_synonym
end.flatten.uniq
end
Expand Down

0 comments on commit 992e410

Please sign in to comment.