From 89ee7e1a43bca0fc382c23176d1c6aed97b2750b Mon Sep 17 00:00:00 2001
From: Patrick J Cherry <patrick@bytemark.co.uk>
Date: Sun, 19 Jun 2011 22:52:36 +0100
Subject: Added check to make sure reminders are fired at the correct time, as
 per the "during" statement.

---
 lib/mauve/alert_changed.rb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'lib/mauve')

diff --git a/lib/mauve/alert_changed.rb b/lib/mauve/alert_changed.rb
index a17c32f..ebcbbda 100644
--- a/lib/mauve/alert_changed.rb
+++ b/lib/mauve/alert_changed.rb
@@ -109,6 +109,7 @@ module Mauve
         unless alert_group.notifications.nil?
 
           alert_group.notifications.each do |notification|
+
             #
             # Build an array of people that could/should be notified.
             #
@@ -128,7 +129,12 @@ module Mauve
             #
             notification_people.sort.uniq.each do |np|
               if np == self.person
-                Configuration.current.people[np].remind(alert, level)
+                #
+                # Only remind if the time is right. 
+                #
+                if DuringRunner.new(Time.now, alert, &notification.during).now?
+                  Configuration.current.people[np].remind(alert, level)
+                end
                 self.remind_at = notification.remind_at_next(alert)
                 save
                 saved = true
-- 
cgit v1.2.3