mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-17 21:54:06 +00:00
New associations and models: schedule versioning
For the schedule versioning in the admin interface (having multiple possible shcedules) we need to change some models and associations. It has also been create a rake:move_events_attributes task to migrate the data. User Interface addapted to make use of the introduced associations and models
This commit is contained in:
parent
e34a1904e0
commit
c047ffd699
21 changed files with 165 additions and 49 deletions
|
|
@ -7,6 +7,7 @@ class Program < ActiveRecord::Base
|
|||
has_many :event_types, dependent: :destroy
|
||||
has_many :tracks, dependent: :destroy
|
||||
has_many :difficulty_levels, dependent: :destroy
|
||||
has_many :schedules, dependent: :destroy
|
||||
has_many :events, dependent: :destroy do
|
||||
def require_registration
|
||||
where(require_registration: true, state: :confirmed)
|
||||
|
|
@ -26,12 +27,12 @@ class Program < ActiveRecord::Base
|
|||
where(state: :confirmed)
|
||||
end
|
||||
|
||||
def scheduled
|
||||
where.not(start_time: nil).where.not(room: nil).order(start_time: :asc)
|
||||
def scheduled(schedule_id)
|
||||
joins(:event_schedules).where('event_schedules.schedule_id = ? AND event_schedules.start_time IS NOT NULL AND event_schedules.room_id IS NOT NULL', schedule_id)
|
||||
end
|
||||
|
||||
def unscheduled
|
||||
confirmed.where('start_time IS NULL OR room_id IS NULL')
|
||||
select(&:unscheduled?)
|
||||
end
|
||||
|
||||
def highlights
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue