casa icon indicating copy to clipboard operation
casa copied to clipboard

Allow supervisors to see *all* volunteers (including those without learning hours)

Open lenikadali opened this issue 1 year ago • 2 comments

What github issue is this PR for, if any?

Resolves #5979

What changed, and why?

We need to add a new query that shows all volunteers. The current implementation only shows volunteers with hours entered, and not volunteers who've been added but do not have learning hours entered.

How is this tested? (please write tests!) 💖💪

This is a work in progress but should we settle on the implementation, there should be tests in spec/models/supervisor_volunteer.rb for the newly added scope.

Note: if you see a flake in your test build in github actions, please post in slack #casa "Flaky test: " :) 💪 Note: We love capybara tests! If you are writing both haml/js and ruby, please try to test your work with tests at every level including system tests like https://github.com/rubyforgood/casa/tree/main/spec/system

Screenshots please :)

None yet.

Feelings gif (optional)

alt text

lenikadali avatar Oct 03 '24 15:10 lenikadali

so this https://github.com/rubyforgood/casa/blob/11d3e28d22d3104071c3507a96d7eaae40db58bb/app/controllers/learning_hours_controller.rb#L7 is where @learning_hours comes from. And is used here: https://github.com/rubyforgood/casa/blob/11d3e28d22d3104071c3507a96d7eaae40db58bb/app/policies/learning_hour_policy.rb#L32

That means that you would want to have the newly changed learning hours scope on the LearningHour here: https://github.com/rubyforgood/casa/blob/01b966b5fa2ad4ac7044f47511229eb66522926b/app/models/learning_hour.rb#L19

Also just to clarify (maybe you can tell me this doesnt work) but this will return LearningHours opposed to Supervisor or Volunteers but as long as it provides a display_name, total_time_spent, user_id, etc it works

elasticspoon avatar Oct 09 '24 00:10 elasticspoon

@elasticspoon so I've updated the PR to use the LearningHour model instead. However, it still doesn't show the volunteer when you click on the Learning Hours tab.

Steps to reproduce:

  1. Create a new volunteer who is supervised by Mrs. Hung Bergstrom
  2. The new volunteer should appear under the list of volunteers at the /volunteers index page.
  3. When you click on the Learning Hours tab, you will see only the volunteers with learning hours entered. The new volunteer will not appear as they do not have learning hours entered yet.

lenikadali avatar Oct 14 '24 12:10 lenikadali

Closing this since it hasn't moved for a while now :slightly_smiling_face:

lenikadali avatar Nov 19 '24 13:11 lenikadali