diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2013-05-01 09:53:50 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2013-05-01 09:53:50 +0100 |
commit | e9f52fa495d4e1e5dc0a3cc5fa51055372345147 (patch) | |
tree | 0f375f866a71aa529d5e3ecb387aba3eea0a187f | |
parent | ada66c90b081076579d28a9b1d3ec2767c63701f (diff) |
Altered alert_group to only set one reminder.
-rw-r--r-- | lib/mauve/alert_group.rb | 14 |
1 files changed, 8 insertions, 6 deletions
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 |