From fd8256beea549a1650cd8fbe1f1d79c7b08a0772 Mon Sep 17 00:00:00 2001
From: Patrick J Cherry <patrick@bytemark.co.uk>
Date: Fri, 17 Jun 2011 18:06:46 +0100
Subject:  Reinstated relevance.

---
 lib/mauve/alert_changed.rb | 3 +++
 lib/mauve/notification.rb  | 4 ++--
 lib/mauve/person.rb        | 3 ++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/mauve/alert_changed.rb b/lib/mauve/alert_changed.rb
index a07dfa1..165ddff 100644
--- a/lib/mauve/alert_changed.rb
+++ b/lib/mauve/alert_changed.rb
@@ -60,10 +60,13 @@ module Mauve
     # @author Matthew Bloch
     # @return [Boolean] true if it was relevant, false otherwise.
     def was_relevant_when_raised?
+
       if :acknowledged == update_type.to_sym and true == was_relevant
         return true 
       end
+
       return was_relevant if update_type.to_sym == :raised
+
       previous = AlertChanged.first(:id.lt => id, 
                                     :alert_id => alert_id,
                                     :person => person)
diff --git a/lib/mauve/notification.rb b/lib/mauve/notification.rb
index 7ce0da3..2f77a13 100644
--- a/lib/mauve/notification.rb
+++ b/lib/mauve/notification.rb
@@ -83,7 +83,7 @@ module Mauve
     end
 
     def working_hours? 
-      now.working_hours?
+      @time.working_hours?
     end
 
     # Return true in the dead zone between 3 and 7 in the morning.
@@ -92,7 +92,7 @@ module Mauve
     #
     # @return [Boolean] Whether now is a in the dead zone or not.
     def dead_zone?
-      now.dead_zone?
+      @time.dead_zone?
     end
 
   end
diff --git a/lib/mauve/person.rb b/lib/mauve/person.rb
index 2689bb3..2a6ddee 100644
--- a/lib/mauve/person.rb
+++ b/lib/mauve/person.rb
@@ -116,6 +116,7 @@ module Mauve
 
         # Deals with AlertChange database entry.
         last_change = AlertChanged.first(:alert_id => alert.id, :person => username)
+
         if not last_change.nil?
           if not last_change.remind_at.nil? and not remind_at.nil?
             if last_change.remind_at.to_time < remind_at
@@ -139,7 +140,7 @@ module Mauve
           last_change.was_relevant = true if false == last_change.nil?
         end
 
-        send_alert(level, alert  ) # if last_change.was_relevant_when_raised? 
+        send_alert(level, alert) if is_relevant # last_change.was_relevant_when_raised? 
     end
     
     def remind(alert, level)
-- 
cgit v1.2.3