Commit 13c8b21f91c07e7970029e87fbc6997bcf1e16a6
1 parent
35cdcd35
Exists in
master
and in
1 other branch
reset a problem's notice count when it is reopened (by a notice) not when it is resolved
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/models/notice.rb
... | ... | @@ -118,7 +118,7 @@ class Notice |
118 | 118 | end |
119 | 119 | |
120 | 120 | def unresolve_problem |
121 | - problem.update_attribute(:resolved, false) if problem.resolved? | |
121 | + problem.update_attributes!(:resolved => false, :resolved_at => nil, :notices_count => 1) if problem.resolved? | |
122 | 122 | end |
123 | 123 | |
124 | 124 | def cache_attributes_on_problem | ... | ... |
app/models/problem.rb
... | ... | @@ -58,11 +58,11 @@ class Problem |
58 | 58 | end |
59 | 59 | |
60 | 60 | def resolve! |
61 | - self.update_attributes!(:resolved => true, :resolved_at => Time.now, :notices_count => 0) | |
61 | + self.update_attributes!(:resolved => true, :resolved_at => Time.now) | |
62 | 62 | end |
63 | 63 | |
64 | 64 | def unresolve! |
65 | - self.update_attributes!(:resolved => false) | |
65 | + self.update_attributes!(:resolved => false, :resolved_at => nil) | |
66 | 66 | end |
67 | 67 | |
68 | 68 | def unresolved? | ... | ... |