diff --git a/app/models/concerns/has_edam_terms.rb b/app/models/concerns/has_edam_terms.rb index eb70114b6..4c8169f11 100644 --- a/app/models/concerns/has_edam_terms.rb +++ b/app/models/concerns/has_edam_terms.rb @@ -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