diff options
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index f188dcb673c..c2b261825b2 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -57,10 +57,24 @@ class Issue < ActiveRecord::Base state :opened state :reopened state :closed + + before_transition any => :closed do |issue| + issue.closed_at = Time.zone.now + end + + before_transition closed: any do |issue| + issue.closed_at = nil + end end def hook_attrs - attributes + attrs = { + total_time_spent: total_time_spent, + human_total_time_spent: human_total_time_spent, + human_time_estimate: human_time_estimate + } + + attributes.merge!(attrs) end def self.reference_prefix |