Update Lecture-Recording relationship and add Lecture cancellation status

The commit introduces notable changes to the Lecture-Recording model relationship in our application and adds a new cancellation status to Lecture model.

Models Lecture and Recording previously had a belongs_to :recording and belongs_to :lecture relationship respectively. However, this setup was not reflecting the correct relationship between these two entities in the actual educational setup where a lecture can have a recording but a recording is always of a lecture. Thus, the relationship has been revised to has_one :recording in Lecture and belongs_to :lecture in Recording models.

Also, added the ability to mark a lecture as "cancelled". This addresses the requirement of representing real-world scenarios where lectures are sometimes cancelled. This cancellation status is then reflected in the Attendance Tracker view and is also handled in the ScrapePanoptoJob.

Additionally, new changes are reflected in the application's schema, migration files, admin dashboard, and stylesheets (for displaying cancelled lectures).
This commit is contained in:
2023-10-02 09:47:46 +01:00
parent d8a6f27734
commit 58c1280309
10 changed files with 45 additions and 10 deletions
+5 -1
View File
@@ -12,9 +12,10 @@ class LectureDashboard < Administrate::BaseDashboard
attendance: Field::HasOne,
course: Field::BelongsTo,
event_uuid: Field::String,
recording: Field::BelongsTo,
recording: Field::HasOne,
start_time: Field::DateTime,
title: Field::String,
cancelled: Field::Boolean,
created_at: Field::DateTime,
updated_at: Field::DateTime,
}.freeze
@@ -27,6 +28,7 @@ class LectureDashboard < Administrate::BaseDashboard
COLLECTION_ATTRIBUTES = %i[
title
course
cancelled
start_time
recording
].freeze
@@ -37,6 +39,7 @@ class LectureDashboard < Administrate::BaseDashboard
id
attendance
course
cancelled
event_uuid
recording
start_time
@@ -51,6 +54,7 @@ class LectureDashboard < Administrate::BaseDashboard
FORM_ATTRIBUTES = %i[
attendance
course
cancelled
event_uuid
recording
start_time
+1
View File
@@ -10,6 +10,7 @@ class RecordingDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
id: Field::Number,
course: Field::BelongsTo,
lecture: Field::BelongsTo,
recording_uuid: Field::String,
start_time: Field::DateTime,
title: Field::String,