[feat] Endpoint implementation done
This commit is contained in:
parent
7475a40775
commit
21f7d1d8ca
4 changed files with 6 additions and 9 deletions
|
|
@ -114,10 +114,7 @@ class ConferencesController < ApplicationController
|
||||||
|
|
||||||
def live_events
|
def live_events
|
||||||
conference = Conference.find_by(short_title: params[:conference_id])
|
conference = Conference.find_by(short_title: params[:conference_id])
|
||||||
temp = conference.find_live_events
|
conference.find_live_events.to_json
|
||||||
p "TESTTEST"
|
|
||||||
p temp.size()
|
|
||||||
p temp.to_json()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -786,9 +786,9 @@ class Conference < ApplicationRecord
|
||||||
|
|
||||||
def find_live_events
|
def find_live_events
|
||||||
live_events = []
|
live_events = []
|
||||||
for event in program.events
|
program.events.each do |event|
|
||||||
if event.is_live?
|
if event.live?
|
||||||
live_events.append(event)
|
live_events.append(event)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
live_events
|
live_events
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ class Event < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_live?
|
def is_live?
|
||||||
time() >= Time.now && Time.now <= time() + event_type.length
|
time >= Time.now && Time.now <= time + event_type.length
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ Osem::Application.routes.draw do
|
||||||
end
|
end
|
||||||
resources :conferences, only: [:index, :show] do
|
resources :conferences, only: [:index, :show] do
|
||||||
get 'live_events', to: 'conferences#live_events'
|
get 'live_events', to: 'conferences#live_events'
|
||||||
|
|
||||||
resources :booths do
|
resources :booths do
|
||||||
member do
|
member do
|
||||||
patch :withdraw
|
patch :withdraw
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue