new schedule

This commit is contained in:
Ana 2016-06-10 16:33:57 +02:00
parent 0018284c66
commit d8f9de9363
9 changed files with 182 additions and 81 deletions

View file

@ -81,6 +81,16 @@ class Conference < ActiveRecord::Base
result
end
##
# Check if there is any event in the program scheduled.
#
# ====Returns
# * +false+ -> If there aren't schedules events
# * +true+ -> If there are schedules events
def scheduled?
self.program.events.where.not(start_time: nil).any?
end
##
# Checks if the user is registered to the conference
#

View file

@ -223,6 +223,20 @@ class Event < ActiveRecord::Base
(100 * result.values.count(true) / result.values.compact.count).to_s
end
##
# Returns the number of columns this event should span in the schedule
#
def span
self.event_type.length / EventType::LENGTH_STEP
end
##
# Returns end of the event
#
def end_time
self.start_time + self.event_type.length.minutes
end
private
##

View file

@ -10,6 +10,7 @@ class EventType < ActiveRecord::Base
alias_attribute :name, :title
# If LENGTH_STEP > 60 the public schedule must be changed
LENGTH_STEP = 15
private