Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

lenikadali
Copy link

@lenikadali lenikadali commented Oct 3, 2024

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

Added a new scope to SupervisorVolunteer so that we can return
the learning hours of *all* volunteers (including those without
hours entered)

Also added the supervisor_volunteer variable to the templates
so that we use it instead of @learning_hour
@github-actions github-actions bot added ruby Pull requests that update Ruby code erb labels Oct 3, 2024
@lenikadali lenikadali changed the title Add scope, variable to templates Allow supervisors to see *all* volunteers (including those without learning hours) Oct 3, 2024
@elasticspoon
Copy link
Collaborator

so this

@learning_hours = policy_scope(LearningHour)
is where @learning_hours comes from. And is used here:
scope.supervisor_volunteers_learning_hours(@user.id)

That means that you would want to have the newly changed learning hours scope on the LearningHour here:

scope :supervisor_volunteers_learning_hours, ->(supervisor_id) {

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

Reverted the changes made to the SupervisorVolunteer model
and switched to use LearningHour as originally intended
@lenikadali
Copy link
Author

@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
Copy link
Author

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

@lenikadali lenikadali closed this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erb ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Cannot access Learning Hours Report for volunteers as Supervisor
3 participants