summaryrefslogtreecommitdiff
path: root/app/graphql/types/merge_request_connection_type.rb
blob: d009b67bc0f14732c07f8bc4c79fec63d73af252 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# frozen_string_literal: true

module Types
  # rubocop: disable Graphql/AuthorizeTypes
  class MergeRequestConnectionType < Types::CountableConnectionType
    field :total_time_to_merge, GraphQL::FLOAT_TYPE, null: true,
          description: 'Total sum of time to merge, in seconds, for the collection of merge requests.'

    # rubocop: disable CodeReuse/ActiveRecord
    def total_time_to_merge
      object.items.reorder(nil).total_time_to_merge
    end
    # rubocop: enable CodeReuse/ActiveRecord
  end
end