move ids_from_string to query instance

This commit is contained in:
Alexander Meindl 2023-01-21 10:42:53 +01:00
parent 801e292020
commit 7c17cf5e0d
3 changed files with 5 additions and 5 deletions

View File

@ -59,7 +59,7 @@ module AdditionalsQuery
def sql_for_ids_field(_field, operator, value)
if operator == '='
# accepts a comma separated list of ids
ids = Additionals.ids_from_string value.first
ids = ids_from_string value.first
if ids.any?
"#{queried_table_name}.id IN (#{ids.join ','})"
else

View File

@ -47,10 +47,6 @@ module Additionals
[value, options]
end
def ids_from_string(string)
string.to_s.scan(/\d+/).map(&:to_i)
end
def split_ids(phrase, limit: nil)
limit ||= Setting.per_page_options_array.first || 25
raw_ids = phrase.strip_split

View File

@ -61,6 +61,10 @@ module Additionals
@available_filters
end
def ids_from_string(string)
string.to_s.scan(/\d+/).map(&:to_i)
end
def export_limit
Setting.issues_export_limit.to_i
end