Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3406126
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:35:24+00:00 2026-05-18T05:35:24+00:00

I’m re-evaluating my model and way I am trying to solve a particular problem.

  • 0

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.

I want the cron job to look and see emails which are due today (or maybe overdue) and fire off those emails.

Contacts all have their own separate start-dates.

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.

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.

Some challenges I have encountered with my approach:

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?

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:35:24+00:00Added an answer on May 18, 2026 at 5:35 am

    I would also suggest using delayed_job to handle the sending of emails. With delayed_job, you’ll have a queue of tasks with associated times. It allows you to schedule tasks for a particular time in the future. It’s probably more convenient than using cron.

    As far as the scheduling goes, it looks to me like the email doesn’t get sent until the call is done, so the email entry in the queue should be created at the point when the app is notified of call completion. The date calculation should then be as simple as Time.now + 4.days.

    If there is more than one call that has to be done before the email goes out, then you’ll just need to check that ALL the calls have been completed before you put the email on the queue for sending.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.