lecture-attendance-manager/app/models/tracked_time_entry.rb
Joshua Coles 6a2f053bb6 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
2023-10-07 15:53:31 +01:00

17 lines
296 B
Ruby

class TrackedTimeEntry < ApplicationRecord
belongs_to :subject, polymorphic: true
enum :kind, [
:concurrent,
:catchup,
:preparation,
:review
]
def duration
toggl_data['time_entries'].sum { |entry| entry['seconds'] }
.seconds
end
end