Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nimmolo committed Jan 27, 2025
1 parent 0103a86 commit 8b7deaa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 213 deletions.
10 changes: 3 additions & 7 deletions app/classes/lookup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ def lookup_titles
instances.map(&:"#{@name_column}")
end

# This is checking for an instance, then sanity-checking for an instance of
# the wrong model, then for an ID, then yielding to the lookup lambda.
# In the last condition, `yield` means run any lambda block provided to this
# method. (It only looks up the record in the case it can't find an ID.)
def evaluate_values_as_ids
@vals.map do |val|
if val.is_a?(@model)
Expand All @@ -57,8 +53,8 @@ def evaluate_values_as_ids
raise("Passed a #{val.class} to LookupIDs for #{@model}.")
elsif /^\d+$/.match?(val.to_s)
val
else # each lookup returns an array
lookup_method(val).map(&:id)
else
lookup_method(val).map(&:id) # each lookup returns an array
end
end.flatten.uniq.compact
end
Expand All @@ -71,7 +67,7 @@ def evaluate_values_as_instances
raise("Passed a #{val.class} to LookupIDs for #{@model}.")
elsif /^\d+$/.match?(val.to_s)
@model.find(val.to_i)
else # each lookup returns an array
else
lookup_method(val)
end
end.flatten.uniq.compact
Expand Down
2 changes: 1 addition & 1 deletion app/classes/lookup/names.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def lookup_ids
names.map(&:id)
end

# If we got params, look up all instances from the ids.
# Look up all instances from the ids. Too complicated otherwise.
def lookup_instances
return [] if @vals.blank?

Expand Down
1 change: 0 additions & 1 deletion app/classes/query/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class Query::Base
include Query::Modules::Initialization
include Query::Modules::Joining
include Query::Modules::LookupObjects
include Query::Modules::LookupNames
include Query::Modules::LowLevelQueries
include Query::Modules::NestedQueries
include Query::Modules::Ordering
Expand Down
204 changes: 0 additions & 204 deletions app/classes/query/modules/lookup_names.rb

This file was deleted.

0 comments on commit 8b7deaa

Please sign in to comment.