implementation in progress

This commit is contained in:
Jimmy 2021-03-12 10:38:47 -08:00
parent 51f9ba0206
commit 7475a40775
4 changed files with 12 additions and 2 deletions

View file

@ -112,6 +112,14 @@ class ConferencesController < ApplicationController
end end
end end
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()
end
private private
def conference_finder_conditions def conference_finder_conditions

View file

@ -784,7 +784,7 @@ class Conference < ApplicationRecord
end_date < Time.current end_date < Time.current
end end
def find_live_events() def find_live_events
live_events = [] live_events = []
for event in program.events for event in program.events
if event.is_live? if event.is_live?

View file

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

View file

@ -154,6 +154,8 @@ Osem::Application.routes.draw do
end end
end end
resources :conferences, only: [:index, :show] do resources :conferences, only: [:index, :show] do
get 'live_events', to: 'conferences#live_events'
resources :booths do resources :booths do
member do member do
patch :withdraw patch :withdraw