Added WorkItems as a new subject for TrackedTimeEntries.
- Made TrackedTimeEntries polymorphic to belong to both Lecture and WorkItems models - Added associated migrations for existing data - Added to administrate UI
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
class Course < ApplicationRecord
|
||||
has_many :lectures, dependent: :destroy
|
||||
has_many :work_items, dependent: :destroy
|
||||
|
||||
# A course has a standalone connection to its recordings. To be shown they must be associated with a lecture but we
|
||||
# track those not associated with a lecture to avoid duplication.
|
||||
# A course has a standalone connection to its recordings. To be displayed they must be associated with a lecture but
|
||||
# we them independently to avoid re-importing lectures.
|
||||
has_many :recordings, dependent: :destroy
|
||||
|
||||
def import_from_calendar!
|
||||
|
||||
@@ -2,7 +2,7 @@ class Lecture < ApplicationRecord
|
||||
belongs_to :course
|
||||
has_one :recording, dependent: :nullify
|
||||
|
||||
has_many :tracked_time_entries, dependent: :destroy
|
||||
has_many :tracked_time_entries, dependent: :destroy, as: :subject
|
||||
|
||||
enum :kind, [
|
||||
:lecture,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class TrackedTimeEntry < ApplicationRecord
|
||||
belongs_to :lecture
|
||||
belongs_to :subject, polymorphic: true
|
||||
|
||||
enum :kind, [
|
||||
:concurrent,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
class WorkItem < ApplicationRecord
|
||||
belongs_to :course
|
||||
has_many :tracked_time_entries, dependent: :destroy, as: :subject
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user