Class: Kidspire::Event
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Kidspire::Event
- Defined in:
- app/models/kidspire/event.rb
Constant Summary collapse
- PCO_SOURCES =
%w[calendar check_ins].freeze
Instance Method Summary collapse
Instance Method Details
#age_eligible?(child) ⇒ Boolean
26 27 28 29 30 31 32 |
# File 'app/models/kidspire/event.rb', line 26 def age_eligible?(child) return true if age_min.nil? && age_max.nil? return true if child.age.nil? return false if age_min && child.age < age_min return false if age_max && child.age > age_max true end |
#full? ⇒ Boolean
22 23 24 |
# File 'app/models/kidspire/event.rb', line 22 def full? spots_remaining&.zero? end |
#spots_remaining ⇒ Object
17 18 19 20 |
# File 'app/models/kidspire/event.rb', line 17 def spots_remaining return nil if capacity.nil? capacity - registrations.count end |