You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
596 B
20 lines
596 B
class Event < ActiveRecord::Base
|
|
translates :info, :title
|
|
|
|
belongs_to :conference
|
|
belongs_to :event_location
|
|
|
|
def conference_day
|
|
return nil unless start_time.present? && end_time.present?
|
|
|
|
start_day = conference.start_date.change(hour: 0, minute: 0, second: 0)
|
|
w_start_day = start_time.change(hour: 0, minute: 0, second: 0)
|
|
return (((w_start_day - start_day) / 86400) + 1).to_i
|
|
end
|
|
|
|
def duration
|
|
return nil unless start_time.present? && end_time.present?
|
|
((end_time - start_time) / 60).to_i
|
|
end
|
|
|
|
end
|
|
|