[fix] live_events return json; use the provided happening_now? function

This commit is contained in:
Jimmy 2021-03-17 07:34:42 +08:00 committed by CactusPuppy
parent 25af736868
commit 7fe1c597ff
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
3 changed files with 2 additions and 12 deletions

View file

@ -785,13 +785,7 @@ class Conference < ApplicationRecord
end
def find_live_events
live_events = []
program.events.each do |event|
if event.live?
live_events.append(event)
end
end
live_events
program.events.select(&:happening_now?)
end
private

View file

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