Skip to content

Commit

Permalink
Update names.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
nimmolo committed Jan 27, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 80db727 commit 9b09792
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/classes/lookup/names.rb
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ def add_synonyms(min_names)
return min_names if ids.empty?

min_names.reject { |min_name| min_name[2] } +
Name.where(synonym_id: clean_id_set(ids).split(",")).
Name.where(synonym_id: limited_id_set(ids)).
pluck(*minimal_name_columns)
end

@@ -198,4 +198,10 @@ def minimal_name_data(name)
def minimal_name_columns
"id, correct_spelling_id, synonym_id, text_name"
end

# array of max of MO.query_max_array unique ids for use with Arel "in"
# where(<x>.in(limited_id_set(ids)))
def limited_id_set(ids)
ids.map(&:to_i).uniq[0, MO.query_max_array]
end
end

0 comments on commit 9b09792

Please sign in to comment.