diff --git a/app/classes/query/image_with_observations.rb b/app/classes/query/image_with_observations.rb index b1a937f072..ba0b580bfb 100644 --- a/app/classes/query/image_with_observations.rb +++ b/app/classes/query/image_with_observations.rb @@ -11,10 +11,9 @@ class ImageWithObservations < Query::ImageBase def parameter_declarations super.merge( - old_title?: :string, - old_by?: :string, ids?: [Observation] ).merge(observations_parameter_declarations). + merge(observations_coercion_parameter_declarations). merge(bounding_box_parameter_declarations). merge(content_filter_parameter_declarations(Observation)). merge(naming_consensus_parameter_declarations) diff --git a/app/classes/query/initializers/locations.rb b/app/classes/query/initializers/locations.rb index b73b4a836d..7aa5738a1d 100644 --- a/app/classes/query/initializers/locations.rb +++ b/app/classes/query/initializers/locations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Query module Initializers # initializing methods inherited by all Query's for Locations diff --git a/app/classes/query/initializers/observations.rb b/app/classes/query/initializers/observations.rb index 7c2fedbb68..87d2350d47 100644 --- a/app/classes/query/initializers/observations.rb +++ b/app/classes/query/initializers/observations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Query module Initializers # initializing methods inherited by all Query's for Observations @@ -29,6 +31,14 @@ def observations_parameter_declarations confidence?: [:float] } end + + def observations_coercion_parameter_declarations + { + old_title?: :string, + old_by?: :string, + date?: [:date] + } + end end end end diff --git a/app/classes/query/location_with_observations.rb b/app/classes/query/location_with_observations.rb index 42d425477e..d62e15b1ef 100644 --- a/app/classes/query/location_with_observations.rb +++ b/app/classes/query/location_with_observations.rb @@ -10,11 +10,9 @@ class LocationWithObservations < Query::LocationBase def parameter_declarations super.merge( - old_title?: :string, - old_by?: :string, - date?: [:date], ids?: [Observation] ).merge(observations_parameter_declarations). + merge(observations_coercion_parameter_declarations). merge(content_filter_parameter_declarations(Observation)). merge(names_parameter_declarations). merge(naming_consensus_parameter_declarations) diff --git a/app/classes/query/name_with_observations.rb b/app/classes/query/name_with_observations.rb index f8dcf5d29b..687b87a778 100644 --- a/app/classes/query/name_with_observations.rb +++ b/app/classes/query/name_with_observations.rb @@ -11,11 +11,9 @@ class NameWithObservations < Query::NameBase def parameter_declarations super.merge( - old_title?: :string, - old_by?: :string, - date?: [:date], ids?: [Observation] ).merge(observations_parameter_declarations). + merge(observations_coercion_parameter_declarations). merge(bounding_box_parameter_declarations). merge(content_filter_parameter_declarations(Observation)). merge(naming_consensus_parameter_declarations) diff --git a/app/classes/query/observation_base.rb b/app/classes/query/observation_base.rb index eafb694d41..dabb651c0f 100644 --- a/app/classes/query/observation_base.rb +++ b/app/classes/query/observation_base.rb @@ -41,7 +41,7 @@ def local_parameter_declarations regexp?: :string, # for coercions from location needs_naming?: :boolean, in_clade?: :string, - in_region?: :string, + in_region?: :string } end