summaryrefslogtreecommitdiff
path: root/app/models/merge_request/metrics.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/merge_request/metrics.rb')
-rw-r--r--app/models/merge_request/metrics.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/merge_request/metrics.rb b/app/models/merge_request/metrics.rb
index 7f7cf95e388..a0bc41c9cc1 100644
--- a/app/models/merge_request/metrics.rb
+++ b/app/models/merge_request/metrics.rb
@@ -10,6 +10,14 @@ class MergeRequest::Metrics < ActiveRecord::Base
self.first_assigned_to_user_other_than_author = Time.now
end
+ if merge_request.merged? && self.merged_at.blank?
+ self.merged_at = Time.now
+ end
+
+ if merge_request.closed? && self.first_closed_at.blank?
+ self.first_closed_at = Time.now
+ end
+
self.save if self.changed?
end
end