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:
@@ -0,0 +1,6 @@
|
||||
class ChangeLectureRecordingOwnershipRelation < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
remove_column :lectures, :recording_id
|
||||
add_belongs_to :recordings, :lecture
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddCancelledStatusToLecture < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
add_column :lectures, :cancelled, :boolean, default: false
|
||||
end
|
||||
end
|
||||
Generated
+4
-3
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_10_01_183712) do
|
||||
ActiveRecord::Schema[7.0].define(version: 2023_10_02_083755) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
@@ -39,10 +39,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_01_183712) do
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "course_id"
|
||||
t.bigint "recording_id"
|
||||
t.string "event_uuid"
|
||||
t.boolean "cancelled", default: false
|
||||
t.index ["course_id"], name: "index_lectures_on_course_id"
|
||||
t.index ["recording_id"], name: "index_lectures_on_recording_id"
|
||||
end
|
||||
|
||||
create_table "recordings", force: :cascade do |t|
|
||||
@@ -52,7 +51,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_01_183712) do
|
||||
t.bigint "course_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.bigint "lecture_id"
|
||||
t.index ["course_id"], name: "index_recordings_on_course_id"
|
||||
t.index ["lecture_id"], name: "index_recordings_on_lecture_id"
|
||||
t.index ["recording_uuid"], name: "index_recordings_on_recording_uuid", unique: true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user