diff options
author | Patrick J Cherry <patrick@bytemark.co.uk> | 2014-07-03 12:01:25 +0100 |
---|---|---|
committer | Patrick J Cherry <patrick@bytemark.co.uk> | 2014-07-03 12:01:25 +0100 |
commit | 02cd939814dc8aebc80b5a23a3ba6b68f4118864 (patch) | |
tree | 3e74d4e098187fc8e8536c9cef98efa15347c3b0 /lib/mauve/alert_group.rb | |
parent | f6ddf58350e015ee49d35d3ac4a74cce53e62102 (diff) | |
parent | 9e8ee3bec749abf11a71003efd201e1e3fb0843f (diff) |
Merge
Diffstat (limited to 'lib/mauve/alert_group.rb')
-rw-r--r-- | lib/mauve/alert_group.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/mauve/alert_group.rb b/lib/mauve/alert_group.rb index fe78ad9..fe17516 100644 --- a/lib/mauve/alert_group.rb +++ b/lib/mauve/alert_group.rb @@ -236,15 +236,21 @@ module Mauve # OK got the next reminder time. # unless remind_at.nil? - this_reminder = AlertChanged.new( - :level => level.to_s, + # + # Find the last reminder, if available for the same alert, update type, and person. + # + 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, + :remind_at.gt => at + ) + this_reminder.level = level.to_s + this_reminder.at = at + this_reminder.remind_at = remind_at + this_reminder.was_relevant = true this_reminder.save end |