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

4218 customize distribution receipt #4234

Merged
merged 27 commits into from
May 10, 2024

Conversation

nikolaz90
Copy link
Contributor

@nikolaz90 nikolaz90 commented Mar 29, 2024

Resolves #4218

Description

This adds the ability to hide Value and/or package related columns on a printed receipt

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Specs added to DistributionPDF spec.
Specs ran and passed

Log in as organization admin and go to /diaper_bank/manage/edit, 2 radios buttons to hide value and/or package columns on distribution receipts.

Edit :
Capture d'écran 2024-04-20 200549

Show:
Capture d'écran 2024-04-20 200414

Pdf with different columns hidden :

Capture d'écran 2024-03-29 131045 Capture d'écran 2024-03-29 131101 Capture d'écran 2024-03-29 131142

@nikolaz90
Copy link
Contributor Author

nikolaz90 commented Mar 29, 2024

Just re read the issue, I believe I may have misread it.
The options should be persisted on the organisation table and should be modifiable from the organization settings... This PR does not do that yet...

@nikolaz90 nikolaz90 mentioned this pull request Apr 4, 2024
3 tasks
@nikolaz90 nikolaz90 closed this Apr 11, 2024
@nikolaz90 nikolaz90 reopened this Apr 11, 2024
@nikolaz90
Copy link
Contributor Author

nikolaz90 commented Apr 20, 2024

Sorry this took so long, work / life balance...
Specs passed locally, will try to figure out why there are some failures here with seed 64957 and 40804

@nikolaz90 nikolaz90 marked this pull request as ready for review April 20, 2024 19:32
@nikolaz90 nikolaz90 changed the title 4218 customize distribution receipt WIP 4218 customize distribution receipt Apr 20, 2024
@dorner
Copy link
Collaborator

dorner commented Apr 21, 2024

You can try passing an explicit name to your item to avoid this.

@cielf
Copy link
Collaborator

cielf commented Apr 23, 2024

Hey @nikolaz90 -- If I run bin/setup, then rails db:migrate I'm getting duplicate column errors. Might be a problem on my end, but thought you should know.

@nikolaz90
Copy link
Contributor Author

nikolaz90 commented Apr 24, 2024

Wow, my bad, I committed the wrong timestamp on the schema.rb on resolving the conflict... Thanks for letting me know and please accept my apologies.

I subsequently ran bin/setup and that is now functionning.

Copy link
Collaborator

@cielf cielf left a comment

Choose a reason for hiding this comment

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

Passes my testing. @dorner - Can you take a look?

@@ -11,6 +11,8 @@
# enable_child_based_requests :boolean default(TRUE), not null
# enable_individual_requests :boolean default(TRUE), not null
# enable_quantity_based_requests :boolean default(TRUE), not null
# hide_package_column_on_receipt :boolean default(FALSE)
# hide_value_columns_on_receipt :boolean default(FALSE)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@cielf I'm kind of starting to feel like some of these fields belong in a "settings" model. E.g. these and ytd_on_distribution_printout - these are suuuper particular to be sitting on essentially our "god model". Thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a convenience factor in having the organization view looking just at the organization model, I suppose. I do agree that a lot of these are really really specific.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's talk about it on Sunday -- it would be a new issue, in any case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to refactor this PR to include a settings table, or print options table if that helps

col_index = data.first.find_index(col_name)
data.each { |line| line.delete_at(col_index) } if col_index.present?
end
data
Copy link
Collaborator

Choose a reason for hiding this comment

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

There isn't really a reason to return data here since the operation is mutating the object itself. You can just call it like a method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, just updated that.

@dorner
Copy link
Collaborator

dorner commented May 10, 2024

This looks good to me, but there are conflicts with main @nikolaz90 - can you fix?

@cielf did you want to take a look?

@cielf
Copy link
Collaborator

cielf commented May 10, 2024

I should be able to kick the tires tomorrow morning. I already did once, so I expect it will be quick.

@nikolaz90
Copy link
Contributor Author

Hello!
Updated to resolve conflicts.
Not quite sure why the specs are failing in exports/export_distributions_csv_service_spec.rb
Let me know if I can do anything :)

@cielf
Copy link
Collaborator

cielf commented May 10, 2024

Working just fine on my functional check.

@cielf
Copy link
Collaborator

cielf commented May 10, 2024

As for the test, I just ran that test on main on my local, and it failed too. If I'm reading things right, we just introduced a change in that test last night. @dorner -- how would you like to proceed -- do you want to roll back that change?

@dorner
Copy link
Collaborator

dorner commented May 10, 2024

Opened a PR for this #4347

@dorner dorner merged commit 2716d6c into rubyforgood:main May 10, 2024
19 checks passed
@dorner
Copy link
Collaborator

dorner commented May 10, 2024

All good - thanks!

Copy link
Contributor

@nikolaz90: Your PR 4218 customize distribution receipt is part of today's Human Essentials production release: 2024.05.12.
Thank you very much for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customizing distribution receipt
3 participants