mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-12 08:04:34 +08:00
Minor repository search refactoring. [SCI-1357]
This commit is contained in:
parent
be4a8d494a
commit
e38947b1f8
1 changed files with 3 additions and 6 deletions
|
@ -191,12 +191,9 @@ class RepositoryDatatable < AjaxDatatablesRails::Base
|
||||||
search_val = params[:search][:value]
|
search_val = params[:search][:value]
|
||||||
|
|
||||||
filtered_ids = RepositoryRow.select do |r|
|
filtered_ids = RepositoryRow.select do |r|
|
||||||
[r.name, r.created_at.to_s, r.created_by.full_name].any? do |s|
|
row_cells = [r.name, r.created_at.to_s, r.created_by.full_name]
|
||||||
s.include?(search_val)
|
row_cells.push(*r.repository_cells.collect { |c| c.value.data })
|
||||||
end ||
|
row_cells.any? { |c| c.include?(search_val) }
|
||||||
r.repository_cells.map do |c|
|
|
||||||
c.value.data.include?(search_val)
|
|
||||||
end.any?
|
|
||||||
end
|
end
|
||||||
records.where!(id: filtered_ids)
|
records.where!(id: filtered_ids)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue