debian-mirror-gitlab/app/graphql/types/merge_request_connection_type.rb

16 lines
514 B
Ruby
Raw Normal View History

2021-02-22 17:27:13 +05:30
# frozen_string_literal: true
module Types
# rubocop: disable Graphql/AuthorizeTypes
class MergeRequestConnectionType < Types::CountableConnectionType
field :total_time_to_merge, GraphQL::FLOAT_TYPE, null: true,
2021-03-11 19:13:27 +05:30
description: 'Total sum of time to merge, in seconds, for the collection of merge requests.'
2021-02-22 17:27:13 +05:30
# rubocop: disable CodeReuse/ActiveRecord
def total_time_to_merge
object.items.reorder(nil).total_time_to_merge
end
# rubocop: enable CodeReuse/ActiveRecord
end
end