aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2013-05-16 12:41:39 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2013-05-16 12:41:39 +0100
commitfde3c31f440de5cab50aa94946d3da205ea3180b (patch)
treec2c5b18d648872aa8ab603b12cb6314519199d66
parent5593ea62e25e079ed630d268602162b48b99a1c1 (diff)
parent72723a723ef7c6bf368b472c32fca3c7c397616a (diff)
merge
-rw-r--r--lib/mauve/person.rb7
-rw-r--r--test/tc_mauve_person.rb7
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/mauve/person.rb b/lib/mauve/person.rb
index eb6e28b..8ce0952 100644
--- a/lib/mauve/person.rb
+++ b/lib/mauve/person.rb
@@ -168,10 +168,11 @@ module Mauve
return true if !AlertGroup::LEVELS.include?(level) or AlertGroup::LEVELS.index(level) == 0
#
- # Suppress this notification if all of the preceeding notifications were of the same or higher level.
+ # Suppress this notification if all the last N of the preceeding
+ # notifications were of a equal or higher level.
#
- return previous_notifications.alerts.all? do |a|
- AlertGroup::LEVELS.index(a.level) >= AlertGroup::LEVELS.index(level)
+ return previous_notifications.first(number).alerts.all? do |a|
+ AlertGroup::LEVELS.index(a.level) >= AlertGroup::LEVELS.index(level)
end
end
diff --git a/test/tc_mauve_person.rb b/test/tc_mauve_person.rb
index f3910bf..0d4b695 100644
--- a/test/tc_mauve_person.rb
+++ b/test/tc_mauve_person.rb
@@ -274,6 +274,13 @@ EOF
[4, true, alerts[1]],
[5, false, alerts.first],
[6, true, alerts[1]],
+ [7, false, alerts[1]],
+ [8, false, alerts[1]],
+ [9, false, alerts[1]],
+ [10, true, alerts[2]],
+ [11, true, alerts[2]],
+ [12, false, alerts[2]],
+ [13, false, alerts.first]
].each do |offset, notification_sent, alert|
#
# Advance in to the future!