Create TrackedTimeEntry as more general replacement of Attendance to include preparation and review

This commit is contained in:
2023-10-06 21:09:28 +01:00
parent c706aa2561
commit a2dfad331b
5 changed files with 44 additions and 0 deletions
+2
View File
@@ -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,
+13
View File
@@ -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