happening now - model implementation
This commit is contained in:
parent
157924803c
commit
51f9ba0206
2 changed files with 14 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
# id :bigint not null, primary key
|
||||
# abstract :text
|
||||
# comments_count :integer default(0), not null
|
||||
# committee_review :text
|
||||
# description :text
|
||||
# guid :string not null
|
||||
# is_highlight :boolean default(FALSE)
|
||||
|
|
@ -338,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
|
||||
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue