Add better capacity for live lectures
This commit is contained in:
parent
9da49ceed8
commit
18f2399c0e
@ -19,6 +19,10 @@ class LectureController < ApplicationController
|
|||||||
project_id: lecture.course.toggl_project,
|
project_id: lecture.course.toggl_project,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if lecture.is_live?
|
||||||
|
redirect_to lecture.live_video_url, allow_other_host: true
|
||||||
|
end
|
||||||
|
|
||||||
if lecture.recording.present?
|
if lecture.recording.present?
|
||||||
redirect_to lecture.recording.recording_url, allow_other_host: true
|
redirect_to lecture.recording.recording_url, allow_other_host: true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -38,4 +38,13 @@ class Lecture < ApplicationRecord
|
|||||||
def live_video_url
|
def live_video_url
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# NAIVE: Assumes that lectures are 50 minutes long, this is true currently but not assured.
|
||||||
|
def end_time
|
||||||
|
start_time + 50.hour
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_live?
|
||||||
|
live_video_url.present? && start_time.past? && end_time.future?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -60,7 +60,8 @@
|
|||||||
class: 'action-button'
|
class: 'action-button'
|
||||||
%>
|
%>
|
||||||
<% elsif lecture.start_time.past? && !lecture.attended? %>
|
<% elsif lecture.start_time.past? && !lecture.attended? %>
|
||||||
<%= button_to "Start",
|
<% start_label = if lecture.is_live? then "Join" else "Start" end %>
|
||||||
|
<%= button_to start_label,
|
||||||
lectures_start_path(id: lecture.id),
|
lectures_start_path(id: lecture.id),
|
||||||
class: 'action-button'
|
class: 'action-button'
|
||||||
%>
|
%>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user