Story #73 Remind assigned event trainer of their assignment until they acknowledge it - cseseniordesign/reservations GitHub Wiki

End User Documentation

Dev Testing Instructions

  1. Make sure you are on the most recent version of the dev-require-trainer-confirmation branch.
  2. Go to the Users page on the website.
  3. Start editing the user details for yourself.
  4. Scroll down and check the Make Trainer checkbox. This will allow you to be assigned as a Trainer to events. It also adds the My Trainings section to your Home Page.
  5. Click the Update button to finish editing the user.
  6. Go to the Events page. Check all the events and make sure no trainers are assigned to any events. This will ensure other users do not get notifications during your testing.
  7. Create a new event.
  8. Fill out the required sections.
  9. Under the Trainer drop-down, select yourself.
  10. Create the event.
  11. Navigate to config/initializers/scheduler.rb
  12. Copy and paste the following function after the scheduler.cron function:
scheduler.every '20s' do
    system("ruby ././scripts/email_unconfirmed_trainers.rb")
end
  1. Save the file.
  2. Start the server on localhost and navigate to any page. This will start the scheduler.
  3. After about 20 seconds, you should receive an email with the subject "Nebraska Innovation Studio - Unconfirmed Training."
  4. Navigate to your home page (you can use the link in the email).
  5. Scroll down to find your event and click "Confirm Training."
  6. You should not receive any further emails, unless you are a trainer for other events and have not confirmed them yet.
  7. Navigate to the Events page.
  8. Edit the event and remove yourself as a trainer.
  9. Save the event.
  10. Edit the event once again and assign yourself as a trainer.
  11. Navigate to your home page.
  12. Verify that the event is not confirmed.
  13. Stop the program.
  14. Remove the code you added in step 11 and save the file.

Technical Documentation

config/initializers/scheduler.rb

  • Made the email_unconfirmed_trainers script to be called every day at 12:00 PM.

models/user.rb

  • Defined a method to email the trainer when they have an unconfirmed training assignment.

routes/admin/events.rb

  • Set the trainer_confirmed field back to 0 when an event trainer is removed or changed.

routes/events.rb

  • Created a method that is linked to by the "Confirm Trainer" button on the trainer's home page.

scripts/email_unconfirmed_trainers.rb

  • Created script based off the email_expiring_users script.

views/home.erb

  • Added an "Actions" section to the home page's "My Trainings" section, similar to the "Actions" section in the "My Events" section.
  • Added "Confirm Training" button under the "Actions" section. Once clicked, the page refreshes and the button is replaced with a non-clickable checkbox titled "Training Confirmed."