Scraping work
This commit is contained in:
+12
-1
@@ -2,12 +2,13 @@ class Lecture < ApplicationRecord
|
||||
belongs_to :course
|
||||
|
||||
enum :status, [
|
||||
:undetermined,
|
||||
:future,
|
||||
:happening_now,
|
||||
:attended_in_person,
|
||||
:watched_recording,
|
||||
:missed,
|
||||
]
|
||||
], default: :undetermined
|
||||
|
||||
def week_number
|
||||
((start_time.beginning_of_week - Time.new('2023-10-02')) / 1.week).floor
|
||||
@@ -22,4 +23,14 @@ class Lecture < ApplicationRecord
|
||||
|
||||
"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
|
||||
|
||||
Reference in New Issue
Block a user