aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2013-05-13 12:32:57 +0100
committerPatrick J Cherry <patrick@bytemark.co.uk>2013-05-13 12:32:57 +0100
commit829a59b0a2a0b470781b8ebd44481c02fb049421 (patch)
tree95537121cb31aedc2ca37305e1d4a069f3465173 /lib
parent9da878e08673ba06d8c1fc11c98fd94ccdc4a367 (diff)
Proto-supression calculation changes
Diffstat (limited to 'lib')
-rw-r--r--lib/mauve/person.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/mauve/person.rb b/lib/mauve/person.rb
index 979c0ab..3302ecc 100644
--- a/lib/mauve/person.rb
+++ b/lib/mauve/person.rb
@@ -114,7 +114,13 @@ module Mauve
return self.notification_thresholds.any? do |period, previous_alert_times|
#
- # This is going to work out if we would be suppressed if
+ # This is going to work out if we would be suppressed if we send a notification now.
+ #
+ previous_alert_times = History.all(:user => self.username,
+ :type => "notification",
+ :created_at.gt => (now - period),
+ :event.like => '% succeeded')
+
if with_notification_at.nil?
first = previous_alert_times.first
last = previous_alert_times.last
@@ -258,13 +264,13 @@ module Mauve
#
# Remember that we've sent an alert
#
- self.notification_thresholds.each do |period, previous_alert_times|
+ #self.notification_thresholds.each do |period, previous_alert_times|
#
# Hmm.. not sure how to make this thread-safe.
#
- self.notification_thresholds[period].push now
- self.notification_thresholds[period].shift
- end
+ # self.notification_thresholds[period].push now
+ # self.notification_thresholds[period].shift
+ #end
return true