Add online property and live video URL to lecture models, as well as a default value at the course level
This commit is contained in:
@@ -41,6 +41,7 @@ class Course < ApplicationRecord
|
||||
short_lecture_title:,
|
||||
start_time:,
|
||||
event_uuid:,
|
||||
online: summary.include?("LOIL"),
|
||||
}
|
||||
end
|
||||
|
||||
@@ -65,6 +66,12 @@ class Course < ApplicationRecord
|
||||
title: title,
|
||||
start_time: event[:start_time],
|
||||
event_uuid: event[:event_uuid],
|
||||
online: event[:online],
|
||||
live_video_url: if event[:online]
|
||||
self.default_live_video_url
|
||||
else
|
||||
nil
|
||||
end,
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -77,4 +84,8 @@ class Course < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def fill_in_default_live_video_url!
|
||||
lectures.where(live_video_url: nil).update!(live_video_url: self.default_live_video_url)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,10 +39,6 @@ class Lecture < ApplicationRecord
|
||||
tracked_time_entries.review.sum(&:duration).seconds
|
||||
end
|
||||
|
||||
def live_video_url
|
||||
nil
|
||||
end
|
||||
|
||||
# NAIVE: Assumes that lectures are 50 minutes long, this is true currently but not assured.
|
||||
def end_time
|
||||
start_time + 50.hour
|
||||
|
||||
Reference in New Issue
Block a user