From e9f52fa495d4e1e5dc0a3cc5fa51055372345147 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Wed, 1 May 2013 09:53:50 +0100 Subject: Altered alert_group to only set one reminder. --- lib/mauve/alert_group.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/mauve/alert_group.rb') diff --git a/lib/mauve/alert_group.rb b/lib/mauve/alert_group.rb index fe78ad9..1889e64 100644 --- a/lib/mauve/alert_group.rb +++ b/lib/mauve/alert_group.rb @@ -236,15 +236,17 @@ module Mauve # OK got the next reminder time. # unless remind_at.nil? - this_reminder = AlertChanged.new( - :level => level.to_s, + this_reminder = AlertChanged.first_or_new( :alert_id => alert.id, :person => self.name, - :at => at, - :update_type => alert.update_type, - :remind_at => remind_at, - :was_relevant => true) + :remind_at.not => nil + ) + this_reminder.level = level.to_s + this_reminder.at = at + this_reminder.update_type = alert.update_type + this_reminder.remind_at => remind_at + this_reminder.was_relevant = true this_reminder.save end -- cgit v1.2.1