[feat] Endpoint implementation done

This commit is contained in:
Jimmy 2021-03-16 22:10:37 +08:00 committed by CactusPuppy
parent 018bbff7b8
commit 879510bc8c
No known key found for this signature in database
GPG key ID: 4B33B0A3E15E2C82
4 changed files with 6 additions and 9 deletions

View file

@ -114,10 +114,7 @@ class ConferencesController < ApplicationController
def live_events
conference = Conference.find_by(short_title: params[:conference_id])
temp = conference.find_live_events
p "TESTTEST"
p temp.size()
p temp.to_json()
conference.find_live_events.to_json
end
private

View file

@ -786,9 +786,9 @@ class Conference < ApplicationRecord
def find_live_events
live_events = []
for event in program.events
if event.is_live?
live_events.append(event)
program.events.each do |event|
if event.live?
live_events.append(event)
end
end
live_events

View file

@ -338,7 +338,7 @@ class Event < ApplicationRecord
end
def is_live?
time() >= Time.now && Time.now <= time() + event_type.length
time >= Time.now && Time.now <= time + event_type.length
end
private