Class: SpreeCmCommissioner::ReservedBlock

Inherits:
Base
  • Object
show all
Includes:
StoreMetadata
Defined in:
app/models/spree_cm_commissioner/reserved_block.rb

Constant Summary collapse

LOCK_REASONS =

Why a seat was taken off sale by an operator. Stored in private_metadata rather than as a typed column, so it cannot be an ActiveRecord enum — the constant is the source of truth.

gender_balance is deliberately absent: female-only seating is driven by the gender column, and a locked row has no gender, so a lock structurally cannot express it.

%w[maintenance staff agent_allotment vip_hold departure_closed other].freeze

Instance Method Summary collapse

Instance Method Details

#active_on_hold?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'app/models/spree_cm_commissioner/reserved_block.rb', line 48

def active_on_hold?
  on_hold? && !expired?
end

#expired?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/spree_cm_commissioner/reserved_block.rb', line 44

def expired?
  expired_at.present? && expired_at <= Time.current
end

#payment_locked?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'app/models/spree_cm_commissioner/reserved_block.rb', line 52

def payment_locked?
  payment_locked_at.present?
end