Repeated sentence moved to a function

program.selected_schedule.event_schedules.order(start_time: :asc) was repeated several times and it has been moved to conference#selected_event_schedules
This commit is contained in:
Ana 2016-07-28 17:37:11 +02:00
parent beb17165a2
commit 3897ec79ca
3 changed files with 12 additions and 9 deletions

View file

@ -61,6 +61,11 @@ class Program < ActiveRecord::Base
before_create :create_difficulty_levels
validate :check_languages_format
# Returns all event_schedules for the selected schedule ordered by start_time
def selected_event_schedules
selected_schedule.event_schedules.order(start_time: :asc) if selected_schedule
end
##
# Checks if blind_voting is enabled and if voting period is over
# ====Returns