Schedules!

This commit is contained in:
Godwin
2015-09-26 20:05:55 -07:00
parent 34e72144cc
commit bc80c09938
82 changed files with 1669 additions and 268 deletions
+17 -2
View File
@@ -1,2 +1,17 @@
class Event < ActiveRecord::Base
end
class Event < ActiveRecord::Base
belongs_to :conference
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
+2
View File
@@ -0,0 +1,2 @@
class EventLocation < ActiveRecord::Base
end
+13
View File
@@ -87,6 +87,19 @@ class Workshop < ActiveRecord::Base
(user.can_translate? && lang.to_sym != locale.to_sym) || can_edit?(user)
end
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
private
def make_slug
if !self.slug