Sort events by time,room on the linear schedule
This commit is contained in:
parent
5b312459d0
commit
f86c474002
2 changed files with 8 additions and 1 deletions
|
|
@ -41,6 +41,13 @@ class EventSchedule < ApplicationRecord
|
|||
start_time + event.event_type.length.minutes
|
||||
end
|
||||
|
||||
##
|
||||
# Returns a time + room number string for sorting.
|
||||
#
|
||||
def sortable_timestamp
|
||||
"#{start_time.to_i}-#{room&.order}"
|
||||
end
|
||||
|
||||
##
|
||||
# Returns event schedules that are scheduled in the same room and start_time as event
|
||||
#
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class Program < ApplicationRecord
|
|||
|
||||
event_schedules += track.selected_schedule.event_schedules
|
||||
end
|
||||
event_schedules.sort_by(&:start_time)
|
||||
event_schedules.sort_by(&:sortable_timestamp)
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue