Note that there are some explanatory texts on larger screens.

plurals
  1. POHow should I arrange my models and cron rake task to send emails on intervals with different start dates?
    primarykey
    data
    text
    <p>I'm re-evaluating my model and way I am trying to solve a particular problem. I have Contacts that can belong to a Campaign, which is a series of activities such as phone calls and emails, each with a number of days assigned as an attribute determining when it should get sent.</p> <p>I want the cron job to look and see emails which are due today (or maybe overdue) and fire off those emails.</p> <p>Contacts all have their own separate start-dates.</p> <p>Sometime a Call, which needs to take place, say, 6 days from the start, doesn't get done until 10 days. That means the email in the same campaign, set to be done 8 days from the start, needs to be delayed by 4 more days, to 12 days from the start, but only for that particular contact if the delayed Call was for the Contact.</p> <p>I would like from people how they would approaching modeling this and, in particular, come up with on any given day, the right Emails to send.</p> <p>Some challenges I have encountered with my approach:</p> <p>1) When there is no email to send, I error out with nil. I try to catch it, wondering if there's a better way to check. How do people handle that?</p> <p>2) How do you calculate the cascade delay? I use a complicated way of first checking the last date of everything that was completed (completed items have their own record in ContactEmail or ContactCalls for example). I then find the difference in the interval against the attribute 'days.' Then I add that interval to the date that last item was completed.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload