Class: SpreeCmCommissioner::GuestSearcherQuery
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::GuestSearcherQuery
- Defined in:
- app/queries/spree_cm_commissioner/guest_searcher_query.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #call ⇒ Object
- #event_id ⇒ Object
-
#initialize(params) ⇒ GuestSearcherQuery
constructor
A new instance of GuestSearcherQuery.
- #product_ids ⇒ Object
Constructor Details
#initialize(params) ⇒ GuestSearcherQuery
Returns a new instance of GuestSearcherQuery.
5 6 7 |
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 5 def initialize(params) @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 3 def params @params end |
Instance Method Details
#call ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 12 def call return SpreeCmCommissioner::Guest.none if event_id.blank? # Optional check-in-group scope (see Role#check_in_scoped_product_ids), set by the operator export # and the dashboard preview. nil = unrestricted; an array narrows to guests whose ticket's product # is in it — an EMPTY array is a real "no tickets" scope and correctly yields no guests. if product_ids.nil? query else query.joins(line_item: :variant).where(spree_variants: { product_id: product_ids }) end end |
#event_id ⇒ Object
9 |
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 9 def event_id = params[:event_id] |
#product_ids ⇒ Object
10 |
# File 'app/queries/spree_cm_commissioner/guest_searcher_query.rb', line 10 def product_ids = params[:product_ids] |