StanfordHCI/foundry — pull request #137 by negarrahmati (2014-12-08 10:19:05+00:00)
Title: notification emails

In order to test the emails:
1. The following doc briefly explains hor the emails work. The first 4 emails explained here must work. https://docs.google.com/document/d/19eShQ_Il17CyE0hA3NqkZQJk6vIduWZI04smI8ASmQ8/edit.

1.5. rake db:reset and rake db:migrate to delete all existing/running teams.

2. Create a team. Add the dri and members. Don't invite all the members. Draw the handoffs.

3. open a new command line.
4. Start team. Wait until the first task is delayed. Right after it is delayed, type this command in the command line to run the email script:
rake notification:email_delayed_task

You should see an email sent to the dri of the delayed task in the command line. There is a link in the email that asks the dri to estimate the delay. Click on it and estimate the delay. Another email is sent out to the members of the dependent tasks explaining that a task is delayed and will be finished in X minutes.

4. Finish the delayed task. An email is sent out to the members of dependent tasks explaining that the delayed task is now finished.

5. start another task. Let it be delayed. Wait for 20 seconds and then run the command "ake notification:email_delayed_task" in another command line. You should see the following email sent out to members of remaining tasks in the command line:

"Unfortunately, <%= @event_name %> by <%= @dri_role %> is not finished on time. We will notify you when the delayed task is finished or when we receive an estimation of the delay from <%= @dri_role %>. If you are in contact with <%= @dri_role %>, you might ask them to check their email so we can know when the task will be complete."

Note: make sure not to invite all members of the team.

Important note: before pushing to heroku, change call_period variable in lib/tasks/scheduler.rake to 600 (real time).