aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/alert.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2011-08-24 17:26:21 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2011-08-24 17:26:21 +0100
commitedfe588a9a39a761c7433f4d019201505081e289 (patch)
tree1df23a4bd82ec17be81e61e1e64e8f3d640839a5 /lib/mauve/alert.rb
parentc22a82f711abc51eebced905588c9527a9db8895 (diff)
Alert#all_unacknowledged created, reflecting reality of what all_raised was being used for
XMPP alerts now sorted sanely
Diffstat (limited to 'lib/mauve/alert.rb')
-rw-r--r--lib/mauve/alert.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/mauve/alert.rb b/lib/mauve/alert.rb
index 752a132..76e79cd 100644
--- a/lib/mauve/alert.rb
+++ b/lib/mauve/alert.rb
@@ -412,7 +412,11 @@ module Mauve
#
#
def all_raised
- all(:raised_at.not => nil, :acknowledged_at => nil, :cleared_at => nil)
+ all(:raised_at.not => nil, :order => [:raised_at.asc]) & (all(:cleared_at => nil) | all(:raised_at.gte => :cleared_at))
+ end
+
+ def all_unacknowledged
+ all_raised - all_acknowledged
end
def all_acknowledged
@@ -420,7 +424,7 @@ module Mauve
end
def all_cleared
- all(:cleared_at.not => nil, :acknowledged_at => nil)
+ all - all_raised - all_acknowledged
end
# Returns a hash of all the :urgent, :normal and :low alerts.