Module: Queries::Concerns::Conveyances
- Extended by:
- ActiveSupport::Concern
- Included in:
- Queries::CollectionObject::Filter, Otu::Filter
- Defined in:
- lib/queries/concerns/conveyances.rb
Overview
Helpers and facets for queries that reference Conveyances/Sounds
Class Method Summary collapse
Instance Method Summary collapse
-
#conveyances_facet ⇒ Object
!! Duplicate with sounds.
- #set_conveyance_params(params) ⇒ Object
- #sound_id_facet ⇒ Object
- #sounds_facet ⇒ Object
Class Method Details
.merge_clauses ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/queries/concerns/conveyances.rb', line 67 def self.merge_clauses [ :conveyances_facet, :sound_id_facet, :sounds_facet ] end |
.params ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/queries/concerns/conveyances.rb', line 6 def self.params [ :sound_id, :sounds, :conveyances, sound_id: [] ] end |
Instance Method Details
#conveyances_facet ⇒ Object
!! Duplicate with sounds
48 49 50 51 52 53 54 55 56 |
# File 'lib/queries/concerns/conveyances.rb', line 48 def conveyances_facet return nil if conveyances.nil? if conveyances referenced_klass.joins(:conveyances).distinct else referenced_klass.where.missing(:conveyances) end end |
#set_conveyance_params(params) ⇒ Object
36 37 38 39 40 |
# File 'lib/queries/concerns/conveyances.rb', line 36 def set_conveyance_params(params) @sound_id = params[:sound_id] @sounds = boolean_param(params, :sounds) @conveyances = boolean_param(params, :conveyances) end |
#sound_id_facet ⇒ Object
42 43 44 45 |
# File 'lib/queries/concerns/conveyances.rb', line 42 def sound_id_facet return nil if sound_id.empty? referenced_klass.joins(:conveyances).where(conveyances: {sound_id:}) end |
#sounds_facet ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/queries/concerns/conveyances.rb', line 58 def sounds_facet return nil if sounds.nil? if sounds referenced_klass.joins(:conveyances).distinct else referenced_klass.where.missing(:conveyances) end end |