2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
class MergeRequestMetricsService
|
|
|
|
delegate :update!, to: :@merge_request_metrics
|
|
|
|
|
|
|
|
def initialize(merge_request_metrics)
|
|
|
|
@merge_request_metrics = merge_request_metrics
|
|
|
|
end
|
|
|
|
|
|
|
|
def merge(event)
|
|
|
|
update!(merged_by_id: event.author_id, merged_at: event.created_at)
|
|
|
|
end
|
|
|
|
|
|
|
|
def close(event)
|
|
|
|
update!(latest_closed_by_id: event.author_id, latest_closed_at: event.created_at)
|
|
|
|
end
|
|
|
|
|
|
|
|
def reopen
|
|
|
|
update!(latest_closed_by_id: nil, latest_closed_at: nil)
|
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
MergeRequestMetricsService.prepend_mod_with('MergeRequestMetricsService')
|