app/models/email_decider.rb
def now?(last_sent_days_ago)
    case frequency_of_send_rate
    when :daily
      true
    when :once_a_week
      last_sent_days_ago.modulo(7).zero?
    when :twice_a_week
      last_sent_days_ago.modulo(3).zero?
    when :once_a_month
      last_sent_days_ago.modulo(30).zero?
    when :wait
      false
    else
      raise "Unknown case: #{frequency}"
    end
  end
# send an email if you've clicked one in the last 3 days
# back down to twice a week if they've not clicked in the last 7
send an email if you've clicked one in the last 3 days
back down to twice a week if they've not clicked in the last 7
send an email if you ' ve clicked one in the last 3 days back down to twice a week if they ' ve not clicked in the last 7
def now?(last_sent_days_ago)
    case frequency_of_send_rate
    when :daily
      true
    when :once_a_week
      last_sent_days_ago.modulo(7).zero?
    when :twice_a_week
      last_sent_days_ago.modulo(3).zero?
    when :once_a_month
      last_sent_days_ago.modulo(30).zero?
    when :wait
      false
    else
      raise "Unknown case: #{frequency}"
    end
  end
def now? ( last_sent_days_ago ) case frequency_of_send_rate when :daily true when :once_a_week last_sent_days_ago . modulo ( 7 ) . zero? when :twice_a_week last_sent_days_ago . modulo ( 3 ) . zero? when :once_a_month last_sent_days_ago . modulo ( 30 ) . zero? when :wait false else raise "Unknown case: #{frequency}" end end
send an email if you've clicked one in the last 3 days
back down to twice a week if they've not clicked in the last 7
send an email if you ' ve clicked one in the last 3 days back down to twice a week if they ' ve not clicked in the last 7
last_sent_days_ago