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

Add bulk assignment of volunteers to supervisor #5144

Merged
merged 16 commits into from
Feb 25, 2024

Conversation

jamgar
Copy link
Collaborator

@jamgar jamgar commented Aug 22, 2023

styling and controller updates
Add request test for bulk assignment
add datatable checkboxes to volunteer#index view for bulk assignment update styles for volunteer#index table

What github issue is this PR for, if any?

Resolves #2523

What changed, and why?

Added multi select checkboxes to Volunteers#index

How will this affect user permissions?

  • Volunteer permissions: N/A
  • Supervisor permissions: N/A
  • Admin permissions: N/a

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

Created request specs for the bulk assign and unassign

Screenshots please :)

image

image

image

image

image

Feelings gif (optional)

What gif best describes your feeling working on this issue? https://giphy.com/
How to embed:
![alt text](https://media.giphy.com/media/1nP7ThJFes5pgXKUNf/giphy.gif)

Feedback please? (optional)

We are very interested in your feedback! Please give us some :) https://forms.gle/1D5ACNgTs2u9gSdh9

@github-actions github-actions bot added dependencies Pull requests that update a dependency file javascript for use by Github Labeler to mark pull requests that update Javascript code ruby Pull requests that update Ruby code Tests! 🎉💖👏 erb labels Aug 22, 2023
@jamgar jamgar force-pushed the st-eh/2523/AssignMultipleVolunteersAtOnce branch from 0d72870 to 123423d Compare August 25, 2023 02:13
@MalloryPriceDesign
Copy link

@jamgar Thank you for your work on this—it looks fantastic! I'm really looking forward to seeing it in action. I just have a small request: could you please update the text in the modal to match the following:

Choose a new supervisor from the dropdown below to reassign selected volunteers, or select “No Supervisor” to unassign volunteers. When you're ready, go ahead and click the "Confirm" button to apply the changes.

Thank you so much for your help!

@FireLemons
Copy link
Collaborator

can you make your docker and rspec checks pass?

@jamgar
Copy link
Collaborator Author

jamgar commented Aug 31, 2023

@FireLemons I can take another look, but the rspec were failing in main as I tested in that branch to compare.

@littleforest
Copy link
Collaborator

@jamgar could you merge or rebase in the main branch?

@jamgar
Copy link
Collaborator Author

jamgar commented Sep 1, 2023

I think I found the issue with the test 😊 I am fixing now and will rebase.

@jamgar jamgar force-pushed the st-eh/2523/AssignMultipleVolunteersAtOnce branch 3 times, most recently from 4b37087 to 1ec68e1 Compare September 2, 2023 13:58
@FireLemons
Copy link
Collaborator

I'm getting z fighting for the dropdown. I have up to date yarn dependencies and up to date compiled assets.
Screenshot from 2023-09-09 15-23-15

@FireLemons
Copy link
Collaborator

I tried again on a chromium browser(earlier test was on firefox) on a different computer. Got the same result

@bcastillo32
Copy link
Collaborator

@FireLemons can we merge this yet or no? :) @jamgar anything you need help with?

@jamgar
Copy link
Collaborator Author

jamgar commented Oct 13, 2023

I'm getting z fighting for the dropdown. I have up to date yarn dependencies and up to date compiled assets. Screenshot from 2023-09-09 15-23-15

It seems the issue is with the Jquery Select2. If I remove the class 'select2' it goes back to the default select box and shows correct.

@jamgar jamgar force-pushed the st-eh/2523/AssignMultipleVolunteersAtOnce branch from c0c47f1 to 8e68617 Compare October 13, 2023 15:17
@github-actions github-actions bot added dependencies Pull requests that update a dependency file and removed dependencies Pull requests that update a dependency file labels Oct 13, 2023
@FireLemons
Copy link
Collaborator

FireLemons commented Oct 14, 2023

It still looks the same on my machine after a database reset and fresh asset build. I'll try again on a different computer in a while

@FireLemons
Copy link
Collaborator

FireLemons commented Oct 14, 2023

Could you write a system test for this feature? It will simulate a user using the website and might help you verify your feature.

@jamgar
Copy link
Collaborator Author

jamgar commented Oct 16, 2023

It still looks the same on my machine after a database reset and fresh asset build. I'll try again on a different computer in a while

Can you check that 'select2' class is missing from the volunteers.html.erb file in your branch? That was what was causing the zindex issue. After removing the select2 it reverted to the default dropdown and worked
image

I will see about writing a system test.

Co-authored-by: James Garcia <[email protected]>
add datatable checkboxes to volunteer#index view for bulk assignment

add system test for volunteers/index
@jamgar jamgar force-pushed the st-eh/2523/AssignMultipleVolunteersAtOnce branch from 6078721 to 9f6b4b3 Compare October 17, 2023 15:27
Comment on lines 190 to 202
it "sets that association to active" do
valid_parameters = {
supervisor_volunteer: {supervisor_id: supervisor.id, volunteer_ids: [volunteer_1.id, volunteer_2.id, volunteer_3.id]}
}
sign_in(admin)

expect {
post bulk_assignment_supervisor_volunteers_url, params: valid_parameters, headers: {HTTP_REFERER: supervisors_path.to_s}
}.to change(SupervisorVolunteer, :count).by(2) # bc 1 already exists, we are creating 2 new ones
expect(response).to redirect_to volunteers_path

association.reload
expect(association.is_active?).to be(true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like 2 tests. Generally we'd split into 2.

  1. Expect to add for new ones
  2. Expect to make active for inactive ones

Sam Williams added 5 commits January 13, 2024 13:13
@schoork
Copy link
Collaborator

schoork commented Jan 31, 2024

@compwron Can I get your eyes on this review? It's just a code climate issue failing.

@compwron
Copy link
Collaborator

compwron commented Feb 1, 2024

Screenshot 2024-01-31 at 5 34 42 PM

 Failed examples:

rspec ./spec/models/casa_org_spec.rb:97 # CasaOrg generate_contact_types_and_hearing_types generates default contact type groups matches default contact type groups
rspec ./spec/system/volunteers/index_spec.rb:213 # view all volunteers admin user Manage Volunteers button when one or more volunteers selected text matches pluralization of volunteers selected
rspec ./spec/system/volunteers/index_spec.rb:205 # view all volunteers admin user Manage Volunteers button when one or more volunteers selected displays number of volunteers selected
Failed examples:

rspec ./spec/system/volunteers/index_spec.rb:205 # view all volunteers admin user Manage Volunteers button when one or more volunteers selected displays number of volunteers selected
rspec ./spec/policies/supervisor_policy_spec.rb:55 # SupervisorPolicy update? does not allow supervisors to update other supervisors

Randomized with seed 15807
Run yarn lint
yarn run v1.22.21
$ standard
standard: Use JavaScript Standard Style (https://standardjs.com/)
standard: Run `standard --fix` to automatically fix some problems.
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:5:29: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:7:29: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:8:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:10:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:10:32: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:11:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:13:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:13:35: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:14:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:16:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:16:31: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:17:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:19:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:19:42: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:20:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:22:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:22:29: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:23:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:25:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:25:34: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:26:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:28:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:28:38: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:29:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:31:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:31:30: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:32:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:34:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:34:33: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:35:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:37:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:37:31: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:38:22: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:40:1: Import in body of module; reorder to top. (import/first)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:40:36: Strings must use singlequote. (quotes)
  /home/runner/work/casa/casa/app/javascript/controllers/index.js:41:22: Strings must use singlequote. (quotes)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
Error: Process completed with exit code 1.

@@ -318,17 +480,5 @@
expect(input_search.value).to eq("")
end
end

context "when timed out" do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not delete this test.

@compwron
Copy link
Collaborator

compwron commented Feb 1, 2024

It looks like it's getting very close! some yarn lint, and maybe some test failures? They miiight be flakes, but I'm not sure.

@bcastillo32
Copy link
Collaborator

It looks like it's getting very close! some yarn lint, and maybe some test failures? They miiight be flakes, but I'm not sure.

@schoork can you make some magic happen so we can get this merged? 😎

@@ -119,7 +119,7 @@ def no_attempt_for_two_weeks
if volunteer.supervisor.active? &&
volunteer.case_assignments.any? { |assignment| assignment.active? } &&
(volunteer.case_contacts.none? ||
volunteer.case_contacts.maximum(:occurred_at) < (Time.zone.now - 14.days))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since occurred_at is not required for a draft, if a user has only drafts with occurred_at set to nil, this creates a NoMethodError.

@schoork
Copy link
Collaborator

schoork commented Feb 11, 2024

It looks like it's getting very close! some yarn lint, and maybe some test failures? They miiight be flakes, but I'm not sure.

Ugh... before in a parent describe works before let in a child context so was visiting the volunteers_page before the volunteers existed.

@schoork
Copy link
Collaborator

schoork commented Feb 11, 2024

It looks like it's getting very close! some yarn lint, and maybe some test failures? They miiight be flakes, but I'm not sure.

@schoork can you make some magic happen so we can get this merged? 😎

Thanks for the push @bcastillo32

@bcastillo32
Copy link
Collaborator

@FireLemons @littleforest or @compwron - is this good to go for this week's release? :)

@@ -263,6 +263,7 @@
end

find("[data-select-all-target='checkboxAll']").click
sleep(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a good fix and makes tests slow. Let's TODO remove this. @bcastillo32 can you open a ticket to clean this up?

@@ -3994,7 +3994,7 @@ joi@^17.11.0:
"@sideway/formula" "^3.0.1"
"@sideway/pinpoint" "^2.0.0"

jquery@>=1.7, "jquery@>=3.4.0 <4.0.0", jquery@^3.6.4:
jquery@>=1.7, "jquery@>=3.4.0 <4.0.0", jquery@^3.7.1:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to upgrade :)

Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's merge! this will be great to get into prod :)

@compwron compwron merged commit 8928bf1 into main Feb 25, 2024
14 of 15 checks passed
@compwron compwron deleted the st-eh/2523/AssignMultipleVolunteersAtOnce branch February 25, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file erb javascript for use by Github Labeler to mark pull requests that update Javascript code ruby Pull requests that update Ruby code Tests! 🎉💖👏
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a Way to Assign Multiple Volunteers at Once
8 participants