Fix week numbering being off by one and add custom semester starts per module
This commit is contained in:
parent
ef34d1c5b5
commit
915ce5112d
@ -13,7 +13,7 @@ class Lecture < ApplicationRecord
|
|||||||
], default: :undetermined
|
], default: :undetermined
|
||||||
|
|
||||||
def week_number
|
def week_number
|
||||||
((start_time.beginning_of_week - START_OF_YEAR_5_SEMESTER_1) / 1.week).floor
|
((start_time.beginning_of_week - course.semester_start_date.to_time) / 1.week).floor + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
def live_video_url
|
def live_video_url
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
class AddSemesterStartDateToCourse < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
add_column :courses, :semester_start_date, :date, default: START_OF_YEAR_5_SEMESTER_1.to_date
|
||||||
|
end
|
||||||
|
end
|
||||||
3
db/schema.rb
generated
3
db/schema.rb
generated
@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_10_01_163055) do
|
ActiveRecord::Schema[7.0].define(version: 2023_10_01_165128) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|
||||||
@ -30,6 +30,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_10_01_163055) do
|
|||||||
t.jsonb "panopto_folders"
|
t.jsonb "panopto_folders"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
|
t.date "semester_start_date", default: "2023-10-02"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "lectures", force: :cascade do |t|
|
create_table "lectures", force: :cascade do |t|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user