Create TrackedTimeEntry as more general replacement of Attendance to include preparation and review
This commit is contained in:
@@ -3,6 +3,8 @@ class Lecture < ApplicationRecord
|
||||
has_one :attendance, dependent: :destroy
|
||||
has_one :recording, dependent: :nullify
|
||||
|
||||
has_many :tracked_time_entries, dependent: :destroy
|
||||
|
||||
enum :kind, [
|
||||
:lecture,
|
||||
:problems_class,
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class TrackedTimeEntry < ApplicationRecord
|
||||
belongs_to :lecture
|
||||
|
||||
enum :kind, [
|
||||
:concurrent,
|
||||
:catchup
|
||||
]
|
||||
|
||||
def duration
|
||||
toggl_data['time_entries'].sum { |entry| entry['seconds'] }
|
||||
.seconds
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user