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