Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Lookup PORO #2679

Merged
merged 40 commits into from
Jan 28, 2025
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f50b757
Stash Jason's original SQL lookup_names
nimmolo Jan 26, 2025
1a54c92
Update jasons_lookup_names.rb
nimmolo Jan 26, 2025
2124cad
Start a new PORO for Query and other lookups
nimmolo Jan 26, 2025
7418da6
Use more recent lookup_names
nimmolo Jan 26, 2025
051bfce
Add test for the Lookup::Names PORO
nimmolo Jan 26, 2025
7488947
Provide titles for testing and sanity checking
nimmolo Jan 26, 2025
1cb5762
Merge branch 'main' into nimmo-lookups-PORO
nimmolo Jan 26, 2025
80db727
Switch to use PORO
nimmolo Jan 27, 2025
9b09792
Update names.rb
nimmolo Jan 27, 2025
fb021cd
Make lookup_names_by_name param signature same as others
nimmolo Jan 27, 2025
57be97e
Update lookup.rb
nimmolo Jan 27, 2025
e54eadd
Lookup::Names
nimmolo Jan 27, 2025
1adbf34
Fix scope callbacks
nimmolo Jan 27, 2025
6c7b4e4
Update lookup_test.rb
nimmolo Jan 27, 2025
97e95ce
Update query_test.rb
nimmolo Jan 27, 2025
46b2774
Update lookup.rb
nimmolo Jan 27, 2025
cf53343
Further simplify
nimmolo Jan 27, 2025
98d897f
Fix lookup_titles
nimmolo Jan 27, 2025
fb24b38
Update names.rb
nimmolo Jan 27, 2025
33090e9
Delete jasons_lookup_names.rb
nimmolo Jan 27, 2025
251b3f9
Update names.rb
nimmolo Jan 27, 2025
0103a86
Update lookup.rb
nimmolo Jan 27, 2025
8b7deaa
Cleanup
nimmolo Jan 27, 2025
ad13a58
Update lookup.rb
nimmolo Jan 27, 2025
ef04eb2
Be sure model is defined.
nimmolo Jan 27, 2025
a79921f
Switch to @title_column
nimmolo Jan 27, 2025
c03974a
Update lookup.rb
nimmolo Jan 27, 2025
08c8dbf
Update lookup.rb
nimmolo Jan 27, 2025
09c2108
Update names.rb
nimmolo Jan 27, 2025
a378239
Update names.rb
nimmolo Jan 27, 2025
c31f540
Update names.rb
nimmolo Jan 27, 2025
2c83bc7
Update names.rb
nimmolo Jan 27, 2025
7c31da1
Update names.rb
nimmolo Jan 27, 2025
afab2c4
refactor model, title_column as constants, tests
nimmolo Jan 27, 2025
e50ccf8
Allow new lookup capabilities in User
nimmolo Jan 28, 2025
66dbd64
Adjust validation to actually do the lookup
nimmolo Jan 28, 2025
8a4870b
Adjust validation - lookup strings immediately, in case of instance p…
nimmolo Jan 28, 2025
507651d
Add test to `by_user` by login
nimmolo Jan 28, 2025
7c15c8b
More thorough ids tests
nimmolo Jan 28, 2025
defe252
More thorough tests for name ids param (name lookup)
nimmolo Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update names.rb
  • Loading branch information
nimmolo committed Jan 27, 2025
commit 9b097928d33ac77314933cb3c34aa42a5524c462
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
Loading