happening now - model implementation
This commit is contained in:
parent
a746a25b8f
commit
f3db1288cf
2 changed files with 14 additions and 0 deletions
|
|
@ -784,6 +784,16 @@ class Conference < ApplicationRecord
|
||||||
end_date < Time.current
|
end_date < Time.current
|
||||||
end
|
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
|
private
|
||||||
|
|
||||||
# Returns a different html colour for every i and consecutive colors are
|
# Returns a different html colour for every i and consecutive colors are
|
||||||
|
|
|
||||||
|
|
@ -337,6 +337,10 @@ class Event < ApplicationRecord
|
||||||
time <=> other.time
|
time <=> other.time
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def is_live?
|
||||||
|
start_time >= Time.now && Time.now <= start_time + event_type.length
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue