Class: Types::TimeTracking::TimelogConnectionType

Inherits:
CountableConnectionType show all
Defined in:
app/graphql/types/time_tracking/timelog_connection_type.rb

Overview

rubocop: disable Graphql/AuthorizeTypes

Instance Method Summary collapse

Methods inherited from CountableConnectionType

#count

Instance Method Details

#total_spent_timeObject



12
13
14
15
16
17
18
19
20
21
# File 'app/graphql/types/time_tracking/timelog_connection_type.rb', line 12

def total_spent_time
  # rubocop: disable CodeReuse/ActiveRecord
  relation = object.items

  # sometimes relation is an Array
  relation = relation.reorder(nil) if relation.respond_to?(:reorder)
  # rubocop: enable CodeReuse/ActiveRecord

  relation.sum(:time_spent)
end