collectiveidea/hourglass

View on GitHub
app/interactors/send_timer_reminders.rb

Summary

Maintainability
A
0 mins
Test Coverage
class SendTimerReminders
  include Interactor

  before do
    context.date ||= Date.current
  end

  def call
    User.where(time_zone: context.time_zone).for_timer_reminder(date: context.date).each do |user|
      Notifier.timer_reminder(user).deliver_now
      user.timer_reminder_sent!(date: context.date)
    end
  end
end