From 495c44445642cfae8f23fadde299ad5307f5be58 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Thu, 9 Jun 2011 18:09:52 +0100 Subject: Big commit --HG-- rename : views/please_authenticate.haml => views/login.haml --- lib/mauve/alert_group.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/mauve/alert_group.rb') diff --git a/lib/mauve/alert_group.rb b/lib/mauve/alert_group.rb index d8156fa..288b263 100644 --- a/lib/mauve/alert_group.rb +++ b/lib/mauve/alert_group.rb @@ -29,11 +29,14 @@ module Mauve logger.warn "no groups found for #{alert.id}" if groups.empty? # - # Notify each group. + # Notify just the group that thinks this alert is the most urgent. # - groups.each do |grp| - logger.info("notifying group #{groups[0]} of AlertID.#{alert.id}.") - grp.notify(alert) + %w(urgent normal low).each do |lvl| + this_group = groups.find{|grp| grp.level.to_s == lvl} + next if this_group.nil? + logger.info("notifying group #{this_group} of AlertID.#{alert.id} (matching #{lvl})") + this_group.notify(alert) + break end end end -- cgit v1.2.1