Skip to content

Commit

Permalink
relax remind at change check to simple presence check
Browse files Browse the repository at this point in the history
In case of wonky time comparison issues, we'd rather have the reminder rescheduled with minimal
tolerance than not having the reminder set at all
  • Loading branch information
akabiru committed Nov 28, 2024
1 parent 2bebbd5 commit 93e5527
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/services/reminders/update_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UpdateService < ::BaseServices::Update
def after_perform(service_call)
reminder = service_call.result

if remind_at_changed?(reminder)
if remind_at_changed?
destroy_scheduled_reminder_job(reminder.job_id) if reminder.scheduled?
mark_unread_notifications_as_read_for(reminder) if reminder.unread_notifications?

Expand All @@ -44,10 +44,10 @@ def after_perform(service_call)

private

def remind_at_changed?(reminder)
def remind_at_changed?
# For some reason reminder.remind_at_changed? returns false
# so we assume a change if remind_at is present in the params (would have passed contract validation)
params.key?(:remind_at) && reminder.remind_at.to_i == params[:remind_at].to_i
params[:remind_at].present?
end

def destroy_scheduled_reminder_job(job_id)
Expand Down

0 comments on commit 93e5527

Please sign in to comment.