Minor repository search refactoring. [SCI-1357]

This commit is contained in:
Matej Zrimšek 2017-06-14 19:28:53 +02:00
parent be4a8d494a
commit e38947b1f8

View file

@ -191,12 +191,9 @@ class RepositoryDatatable < AjaxDatatablesRails::Base
search_val = params[:search][:value]
filtered_ids = RepositoryRow.select do |r|
[r.name, r.created_at.to_s, r.created_by.full_name].any? do |s|
s.include?(search_val)
end ||
r.repository_cells.map do |c|
c.value.data.include?(search_val)
end.any?
row_cells = [r.name, r.created_at.to_s, r.created_by.full_name]
row_cells.push(*r.repository_cells.collect { |c| c.value.data })
row_cells.any? { |c| c.include?(search_val) }
end
records.where!(id: filtered_ids)
end