human-essentials icon indicating copy to clipboard operation
human-essentials copied to clipboard

Resolves #4985: Picklists should be filterable

Open joepaolicelli opened this issue 8 months ago • 6 comments

Resolves #4985.

Please note I have only intermittently worked with Ruby for the past several years, so apologies in advance for any mistakes due to that. The amount of code changed here is minimal, and I did my best to base it on similar code from elsewhere in the codebase. I ran bin/lint and no issues were detected.

Description

Applies filters to the printable "Unfulfilled Picklists" PDF, instead of always printing every request. Also updates the count shown on the "Print Unfulfilled Picklists".

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

I've added a test to ensure the "Print Unfulfilled Picklists" button shows the correct quantity when filters are applied. However, I was unable to determine how to add a test to check if the correct number of pages are created in the PDF, or if the testing framework was even set up to allow that. Instead, I manually tested several different configurations of filters to ensure that they led to only the expected filtered requests being including in the PDF.

Screenshots

image

joepaolicelli avatar Apr 10 '25 15:04 joepaolicelli

@dorner, @awwaiid Do you have any wisdom to give on how to check that the correct number of pages are generated in a PDF? / If we do that?

cielf avatar Apr 11 '25 18:04 cielf

Thanks for the feedback @dorner! I've simplified the test (filtering on status instead of partner organization) in a way that I think solves your concerns and also fixes some other issues I found. If you approve of the updates and my responses to your comments, I think the only remaining issue is if/how to test the PDF output, as discussed above.

joepaolicelli avatar Apr 16 '25 20:04 joepaolicelli

Re the PDF testing - did you look at https://github.com/rubyforgood/human-essentials/blob/d8fa236212a4114d962d4f7ac1002f42ba058c2e/lib/test_helpers/pdf_comparison_test_factory.rb ?

dorner avatar Apr 22 '25 00:04 dorner

Thanks @dorner, that file looks like it might be the right strategy for the most robust test of this PR. Unfortunately is looks like it is only set up to work with distribution PDFs, not picklists PDFs, and I don't think I'd be the right person to figure out how to adapt/copy that strategy for picklist PDFs.

Since previous work on the picklist page didn't include tests that compared against the generated PDFs, I'm not sure if they're needed for this PR, but if they are perhaps we put this change on hold until someone more familiar with the codebase and RSpec can work on that.

joepaolicelli avatar Apr 28 '25 21:04 joepaolicelli

I think we do need to validate the results in the PDF. If you don't think you'll be able to do that kind of work, I'd rather bump the difficulty for this up to Intermediate and reopen it.

dorner avatar May 02 '25 19:05 dorner

Thank you for the solid start, @joepaolicelli! Per your wishes, I have re-"Help Wanted" the issue so we can get someone with the particular skills needed to work on it.

cielf avatar May 03 '25 01:05 cielf

@dorner I added the PDF test if you want to take another look

jonny5 avatar Sep 17 '25 01:09 jonny5

@dorner updated spec to check for comments from request in body, that seem good?

jonny5 avatar Sep 20 '25 18:09 jonny5

@joepaolicelli: Your PR Resolves #4985: Picklists should be filterable is part of today's Human Essentials production release: 2025.10.05. Thank you very much for your contribution!

github-actions[bot] avatar Oct 05 '25 14:10 github-actions[bot]