From 829a59b0a2a0b470781b8ebd44481c02fb049421 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Mon, 13 May 2013 12:32:57 +0100 Subject: Proto-supression calculation changes --- lib/mauve/person.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/mauve') 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 -- cgit v1.2.1