Stash
This commit is contained in:
+2
-17
@@ -1,6 +1,7 @@
|
||||
class Lecture < ApplicationRecord
|
||||
belongs_to :course
|
||||
has_one :attendance
|
||||
belongs_to :recording
|
||||
|
||||
enum :status, [
|
||||
:undetermined,
|
||||
@@ -12,26 +13,10 @@ class Lecture < ApplicationRecord
|
||||
], default: :undetermined
|
||||
|
||||
def week_number
|
||||
((start_time.beginning_of_week - Time.new('2023-10-02')) / 1.week).floor
|
||||
((start_time.beginning_of_week - START_OF_YEAR_5_SEMESTER_1) / 1.week).floor
|
||||
end
|
||||
|
||||
def live_video_url
|
||||
nil
|
||||
end
|
||||
|
||||
def recording_url
|
||||
return nil if recording_id.nil?
|
||||
|
||||
"https://uniofbath.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=#{recording_id}"
|
||||
end
|
||||
|
||||
def nice_title
|
||||
if course.title == "General Relativity"
|
||||
regex = /.+L(\d+).*/
|
||||
lecture_number = self.title.match(regex)[1].to_i
|
||||
return "Lecture #{lecture_number}"
|
||||
end
|
||||
|
||||
title
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,20 @@
|
||||
# This is a Foreign Object Reference Table, keyed to the external data source by #recording_uuid
|
||||
class Recording < ApplicationRecord
|
||||
belongs_to :course
|
||||
|
||||
def recording_url
|
||||
return nil if recording_uuid.nil?
|
||||
|
||||
"https://uniofbath.cloud.panopto.eu/Panopto/Pages/Viewer.aspx?id=#{recording_uuid}"
|
||||
end
|
||||
|
||||
def nice_title
|
||||
if course.title == "General Relativity"
|
||||
regex = /.+L(\d+).*/
|
||||
lecture_number = self.title.match(regex)[1].to_i
|
||||
return "Lecture #{lecture_number}"
|
||||
end
|
||||
|
||||
title
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user