Class: API::Entities::IssuableTimeStats

Inherits:
Grape::Entity
  • Object
show all
Defined in:
lib/api/entities/issuable_time_stats.rb

Instance Method Summary collapse

Instance Method Details

#total_time_spentObject

rubocop: disable CodeReuse/ActiveRecord



19
20
21
22
# File 'lib/api/entities/issuable_time_stats.rb', line 19

def total_time_spent
  # Avoids an N+1 query since timelogs are preloaded
  object.timelogs.sum(&:time_spent)
end