Fixes issue #944
In the issue description, we were tasked with refactoring the /event/<eventID>/manage_volunteers route.
Changes
The route was originally broken into separate POST and GET controllers, but we thought it was cleanest to combine them into one route, especially since they reuse a bit of code.
There were some variables that were unused either in the controller or passed into the template and never accessed, we removed those.
Some variables were defined unnecessarily like program = event.program which could just be accessed as event.program anywhere necessary in the code.
Adjust variable names to be more descriptive, example: trainedParticipantsList -> trainedParticipantsForProgramAndTerm
Added a docstring and comments to the code to make it a little more readable. Also broke into sections to make it easier to navigate.
Modified the getEventParticipants logic function to return a better representation for this controller since this is the only place it is used.
Updated tests for getEventParticipants accordingly to make sure tests are passing.
All throughout the admin/routes and admin/volunteers controllers and the templates for each respective route there was the usage of eventData which always just duplicated the event object's data. We removed all instances of eventData when unnecessary from each controller and template.
In order to get createEvent.html to render properly, since it does not have an event object associated with it and it still extends eventNav.html, we modified the createEvent.html file to only extend eventNav.html when it is in edit mode and not create mode since we know it will have an event object then.
Testing
git checkout development
git pull origin development
git checkout 944_Refactor_Track_Volunteers
git pull origin 944_Refactor_Track_Volunteers
source setup.sh
./database/reset_database.sh test
./tests/run_tests.sh and ensure all tests pass (the last test in test_participants.py sometimes fails and that is unrelated to our issue).
Navigate to /app/controllers/admin/volunteers and look over the manageVolunteersPage route to ensure that it looks good and there are no unnecessary pieces of code there.
flask run
Create an event.
Once the event is created go to its view page, and then toggle through all pages in the event navigation bar (Manage Volunteers, RSVP Log, etc.) and verify each page loads properly and functions like it should.
Pay special attention to the Manage Volunteers tab and make sure everything works properly.
Replicate previous UI testing steps but with a past event instead.
Issue Description
Fixes issue #944 In the issue description, we were tasked with refactoring the
/event/<eventID>/manage_volunteers
route.Changes
POST
andGET
controllers, but we thought it was cleanest to combine them into one route, especially since they reuse a bit of code.program = event.program
which could just be accessed asevent.program
anywhere necessary in the code.trainedParticipantsList
->trainedParticipantsForProgramAndTerm
getEventParticipants
logic function to return a better representation for this controller since this is the only place it is used.getEventParticipants
accordingly to make sure tests are passing.admin/routes
andadmin/volunteers
controllers and the templates for each respective route there was the usage ofeventData
which always just duplicated theevent
object's data. We removed all instances of eventData when unnecessary from each controller and template.createEvent.html
to render properly, since it does not have anevent
object associated with it and it still extendseventNav.html
, we modified thecreateEvent.html
file to only extendeventNav.html
when it is inedit
mode and notcreate
mode since we know it will have anevent
object then.Testing
git checkout development
git pull origin development
git checkout 944_Refactor_Track_Volunteers
git pull origin 944_Refactor_Track_Volunteers
source setup.sh
./database/reset_database.sh test
./tests/run_tests.sh
and ensure all tests pass (the last test intest_participants.py
sometimes fails and that is unrelated to our issue)./app/controllers/admin/volunteers
and look over themanageVolunteersPage
route to ensure that it looks good and there are no unnecessary pieces of code there.flask run