Story #73 Remind assigned event trainer of their assignment until they acknowledge it - cseseniordesign/reservations GitHub Wiki
End User Documentation
Dev Testing Instructions
- Make sure you are on the most recent version of the
dev-require-trainer-confirmation
branch.
- Go to the Users page on the website.
- Start editing the user details for yourself.
- 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.
- Click the Update button to finish editing the user.
- 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.
- Create a new event.
- Fill out the required sections.
- Under the Trainer drop-down, select yourself.
- Create the event.
- Navigate to
config/initializers/scheduler.rb
- Copy and paste the following function after the
scheduler.cron
function:
scheduler.every '20s' do
system("ruby ././scripts/email_unconfirmed_trainers.rb")
end
- Save the file.
- Start the server on
localhost
and navigate to any page. This will start the scheduler.
- After about 20 seconds, you should receive an email with the subject "Nebraska Innovation Studio - Unconfirmed Training."
- Navigate to your home page (you can use the link in the email).
- Scroll down to find your event and click "Confirm Training."
- You should not receive any further emails, unless you are a trainer for other events and have not confirmed them yet.
- Navigate to the Events page.
- Edit the event and remove yourself as a trainer.
- Save the event.
- Edit the event once again and assign yourself as a trainer.
- Navigate to your home page.
- Verify that the event is not confirmed.
- Stop the program.
- 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."