mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Registration for Events
This commit is contained in:
parent
f188fd5575
commit
01ec43e53a
35 changed files with 522 additions and 46 deletions
|
|
@ -8,10 +8,21 @@ class Program < ActiveRecord::Base
|
|||
has_many :tracks, dependent: :destroy
|
||||
has_many :difficulty_levels, dependent: :destroy
|
||||
has_many :events, dependent: :destroy do
|
||||
def workshops
|
||||
def require_registration
|
||||
where(require_registration: true, state: :confirmed)
|
||||
end
|
||||
|
||||
def with_registration_open
|
||||
where(require_registration: true, state: :confirmed).
|
||||
map { |e| e if e.max_attendees > e.registrations.count }.compact
|
||||
end
|
||||
|
||||
# All confirmed events of the conference with attribute require_registration
|
||||
# excluding the events the user has already registered to
|
||||
def remaining_for_registration(registration)
|
||||
require_registration - registration.events
|
||||
end
|
||||
|
||||
def confirmed
|
||||
where(state: :confirmed)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue