Sort events by time,room on the linear schedule

This commit is contained in:
Michael Ball 2020-07-23 02:28:36 -07:00
parent 5b312459d0
commit f86c474002
2 changed files with 8 additions and 1 deletions

View file

@ -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
#

View file

@ -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
##