Commit 4d2c0143 authored by An Nguyen's avatar An Nguyen
Browse files

Fix advanced search order bug

parent e0cb637a
......@@ -142,12 +142,15 @@ module Chemotion
molecules: create_group_molecule(molecule_scope, sample_scope)
}
else
ids = Kaminari.paginate_array(samples).page(page).per(page_size)
id_array = Kaminari.paginate_array(samples).page(page).per(page_size)
ids = id_array.join(',')
paging_samples = Sample.includes(
:residues, :tag,
collections: :sync_collections_users,
molecule: :tag
).where(id: ids).order("position(id::text in '#{ids}')").to_a
).where(
id: id_array
).order("position(','||id::text||',' in ',#{ids},')").to_a
if search_method == 'advanced'
# sort by order - advanced search
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment