2016-08-25 01:54:41 -04:00
|
|
|
class MergeRequest::Metrics < ActiveRecord::Base
|
|
|
|
belongs_to :merge_request
|
2016-11-15 09:22:35 -05:00
|
|
|
belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :pipeline_id
|
2016-08-25 01:54:41 -04:00
|
|
|
|
|
|
|
def record!
|
2016-08-25 02:25:07 -04:00
|
|
|
if merge_request.merged? && self.merged_at.blank?
|
|
|
|
self.merged_at = Time.now
|
|
|
|
end
|
|
|
|
|
2016-09-20 08:43:11 -04:00
|
|
|
self.save
|
2016-08-25 01:54:41 -04:00
|
|
|
end
|
|
|
|
end
|