Make it a little generic, time to step away for now
Build and Publish Docker Container / build (push) Successful in 5m55s
Build and Publish Docker Container / build (push) Successful in 5m55s
This commit is contained in:
@@ -6,6 +6,10 @@ class Course < ApplicationRecord
|
||||
# we them independently to avoid re-importing lectures.
|
||||
has_many :recordings, dependent: :destroy
|
||||
|
||||
def lectures_and_work_items
|
||||
(lectures + work_items).sort_by(&:start_time)
|
||||
end
|
||||
|
||||
def import_from_calendar!
|
||||
ics_file = HTTParty.get("https://mytimetable.bath.ac.uk/ical?6519757b&group=false&timetable=!MjAyMyFzdHVkZW50c2V0ITRDRjQ5MjlGRTg1M0Q4N0MyMDZENTVDNUQ3QTJFNzk0&eu=amMzMDkxQGJhdGguYWMudWs=&h=MiuDbRiudE_Yf7B25v2SfEuFCtmYGkFb5sAUI3yGmtY=")
|
||||
calendars = Icalendar::Calendar.parse(ics_file)
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
class WorkItem < ApplicationRecord
|
||||
belongs_to :course
|
||||
has_many :tracked_time_entries, dependent: :destroy, as: :subject
|
||||
|
||||
def week_number
|
||||
((start_time.beginning_of_week - course.semester_start_date.to_time) / 1.week).floor + 1
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user