happening now - model implementation

This commit is contained in:
rajavi-mishra 2021-03-12 09:51:24 -08:00 committed by CactusPuppy
parent a746a25b8f
commit f3db1288cf
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
2 changed files with 14 additions and 0 deletions

View file

@ -784,6 +784,16 @@ class Conference < ApplicationRecord
end_date < Time.current
end
def find_live_events()
live_events = []
for event in program.events
if event.is_live?
live_events.append(event)
end
end
live_events
end
private
# Returns a different html colour for every i and consecutive colors are

View file

@ -337,6 +337,10 @@ class Event < ApplicationRecord
time <=> other.time
end
def is_live?
start_time >= Time.now && Time.now <= start_time + event_type.length
end
private
##