Update panopto scraping to separate lectures from recordings. Implement naive lecture creation on new recordings.
This commit is contained in:
parent
9923067a17
commit
ef34d1c5b5
@ -23,7 +23,18 @@ class ScrapePanoptoJob < ApplicationJob
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
Recording.insert_all(attributes, unique_by: :recording_uuid)
|
created = Recording.insert_all(attributes, unique_by: :recording_uuid, returning: [:id, :title, :course_id, :start_time])
|
||||||
|
|
||||||
|
created.each do |new_recording_attrs|
|
||||||
|
new_recording = Recording.new(new_recording_attrs)
|
||||||
|
Lecture.create!(
|
||||||
|
title: new_recording.nice_title,
|
||||||
|
start_time: new_recording.start_time,
|
||||||
|
course_id: new_recording.course_id,
|
||||||
|
status: :undetermined,
|
||||||
|
recording_id: new_recording.id
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
class Lecture < ApplicationRecord
|
class Lecture < ApplicationRecord
|
||||||
belongs_to :course
|
belongs_to :course
|
||||||
has_one :attendance
|
has_one :attendance
|
||||||
belongs_to :recording
|
belongs_to :recording, optional: true
|
||||||
|
|
||||||
enum :status, [
|
enum :status, [
|
||||||
:undetermined,
|
:undetermined,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user