Commit c797986e authored by Florian Hübsch's avatar Florian Hübsch
Browse files

Unique suggestions.

parent e339b3b8
...@@ -13,38 +13,38 @@ module Chemotion ...@@ -13,38 +13,38 @@ module Chemotion
case type case type
when 'sample' when 'sample'
{ {
sample_name: Sample.by_name(params[:query]).pluck(:name), sample_name: Sample.by_name(params[:query]).pluck(:name).uniq,
sum_formula: Molecule.by_formula(params[:query]).map(&:sum_formular), sum_formula: Molecule.by_formula(params[:query]).map(&:sum_formular).uniq,
iupac_name: Molecule.by_iupac_name(params[:query]).map(&:iupac_name) iupac_name: Molecule.by_iupac_name(params[:query]).map(&:iupac_name).uniq
} }
when 'reaction' when 'reaction'
{ {
reaction_name: Reaction.by_name(params[:query]).pluck(:name), reaction_name: Reaction.by_name(params[:query]).pluck(:name).uniq,
sample_name: Sample.with_reactions.by_name(params[:query]).pluck(:name), sample_name: Sample.with_reactions.by_name(params[:query]).pluck(:name).uniq,
iupac_name: Molecule.with_reactions.by_iupac_name(params[:query]).map(&:iupac_name) iupac_name: Molecule.with_reactions.by_iupac_name(params[:query]).map(&:iupac_name).uniq
} }
when 'wellplate' when 'wellplate'
{ {
wellplate_name: Wellplate.by_name(params[:query]).pluck(:name), wellplate_name: Wellplate.by_name(params[:query]).pluck(:name).uniq,
sample_name: Sample.with_wellplates.by_name(params[:query]).pluck(:name), sample_name: Sample.with_wellplates.by_name(params[:query]).pluck(:name).uniq,
iupac_name: Molecule.with_wellplates.by_iupac_name(params[:query]).map(&:iupac_name) iupac_name: Molecule.with_wellplates.by_iupac_name(params[:query]).map(&:iupac_name).uniq
} }
when 'screen' when 'screen'
{ {
screen_name: Screen.by_name(params[:query]).pluck(:name), screen_name: Screen.by_name(params[:query]).pluck(:name).uniq,
conditions: Screen.by_conditions(params[:query]).pluck(:conditions), conditions: Screen.by_conditions(params[:query]).pluck(:conditions).uniq,
requirements: Screen.by_requirements(params[:query]).pluck(:requirements) requirements: Screen.by_requirements(params[:query]).pluck(:requirements).uniq
} }
else else
{ {
sample_name: Sample.by_name(params[:query]).pluck(:name), sample_name: Sample.by_name(params[:query]).pluck(:name).uniq,
sum_formula: Molecule.by_formula(params[:query]).map(&:sum_formular), sum_formula: Molecule.by_formula(params[:query]).map(&:sum_formular).uniq,
iupac_name: Molecule.by_iupac_name(params[:query]).map(&:iupac_name), iupac_name: Molecule.by_iupac_name(params[:query]).map(&:iupac_name).uniq,
reaction_name: Reaction.by_name(params[:query]).pluck(:name), reaction_name: Reaction.by_name(params[:query]).pluck(:name).uniq,
wellplate_name: Wellplate.by_name(params[:query]).pluck(:name), wellplate_name: Wellplate.by_name(params[:query]).pluck(:name).uniq,
screen_name: Screen.by_name(params[:query]).pluck(:name), screen_name: Screen.by_name(params[:query]).pluck(:name).uniq,
conditions: Screen.by_conditions(params[:query]).pluck(:conditions), conditions: Screen.by_conditions(params[:query]).pluck(:conditions).uniq,
requirements: Screen.by_requirements(params[:query]).pluck(:requirements) requirements: Screen.by_requirements(params[:query]).pluck(:requirements).uniq
} }
end end
end end
......
Supports Markdown
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