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

(Fix) chore(deps): bump wicked_pdf from 2.6.3 to 2.8.0 [OFN-12214] #12743

Merged
merged 7 commits into from
Aug 22, 2024

Conversation

wandji20
Copy link
Contributor

@wandji20 wandji20 commented Aug 6, 2024

What? Why?

Remove webpack compiled CSS from order pdf files

What should we test?

Generated order pdf from (print order) should work and look the same as before

Release notes

(Fix) chore(deps): bump wicked_pdf from 2.6.3 to 2.8.0 [OFN-12214]

(Fix) chore(deps): bump wicked_pdf from 2.6.3 to 2.8.0

Dependencies

wicked-pdf

Documentation updates

N/A

Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

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

Removing the stylesheet from the pdf results in order looking differently (before on the right):
print_order

@wandji20
Copy link
Contributor Author

wandji20 commented Aug 7, 2024

Thanks @rioug for reviewing
Did you test this in production or locally?

@rioug
Copy link
Collaborator

rioug commented Aug 7, 2024

Did you test this in production or locally?

locally

@wandji20
Copy link
Contributor Author

wandji20 commented Aug 7, 2024

This should happen locally since wicked_pdf handles assets differently in development and production mode.
Working on this one, I did the following to ensure the gem will try and read assets like in production

  • Unpack the gem with gem unpack wicked_pdf and adjust the code to mimic a production environment
  • Precompiled assets

Then I noticed the mail.scss was not found in wicked_pdf asset finder method.
If we choose to move the mail-related styles to app/assets/stylesheets and precompile the new mail.scss
Then the asset will be found by wicked_pdf asset finder .

Can you please checkout this conversation I had with Maikel

@rioug rioug added pr-staged-au staging.openfoodnetwork.org.au and removed pr-staged-au staging.openfoodnetwork.org.au labels Aug 12, 2024
@rioug
Copy link
Collaborator

rioug commented Aug 12, 2024

Can you please checkout this conversation I had with Maikel

I had missed that sorry!
I just tested the PR on staging and I get the same result :
Screenshot Capture - 2024-08-12 - 11-29-25

If we choose to move the mail-related styles to app/assets/stylesheets and precompile the new mail.scss
Then the asset will be found by wicked_pdf asset finder .

It looks like we'll need to do this, do you want to have a go at it ?

@rioug rioug removed the pr-staged-au staging.openfoodnetwork.org.au label Aug 12, 2024
config/application.rb Outdated Show resolved Hide resolved
@rioug
Copy link
Collaborator

rioug commented Aug 12, 2024

@wandji20 There is a a failing spec, could you have a look at it ?

@wandji20 wandji20 marked this pull request as draft August 12, 2024 23:38
Copy link
Contributor Author

@wandji20 wandji20 Aug 13, 2024

Choose a reason for hiding this comment

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

I am not so positive this is a good change.
So, I noticed a strange output in extracted text from pdf.
This is caused due to multi-line table header values.
Sadly, I could not figure out why it works when the mail.scss is compiled with Webpacker (before changes).

For an invoice with a header (see screenshot)
image
I get this
Screenshot from 2024-08-13 19-08-20
Seems to me it reads the header as two lines instead of one due to the longer header values spanning two lines

Copy link
Member

Choose a reason for hiding this comment

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

This can happen in the conversion to text. It's very unfortunate but I don't think it can be easily solved. So we have to work with it for now.

@wandji20 wandji20 marked this pull request as ready for review August 13, 2024 18:27
@wandji20 wandji20 requested a review from rioug August 13, 2024 18:27
Copy link
Member

Choose a reason for hiding this comment

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

This can happen in the conversion to text. It's very unfortunate but I don't think it can be easily solved. So we have to work with it for now.

Copy link
Collaborator

@rioug rioug left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@drummer83 drummer83 self-assigned this Aug 19, 2024
@drummer83 drummer83 added the pr-staged-au staging.openfoodnetwork.org.au label Aug 19, 2024
@drummer83
Copy link
Contributor

Notes to self for testing:

  • invoices feature toggle on/off
  • individual vs. bulk printing
  • standard vs. alternative template
  • sending vs. printing invoice
  • legacy vs. admin style v3

@RachL
Copy link
Contributor

RachL commented Aug 19, 2024

@drummer83 BUU is about to be displayed to 75% of the users. And also dev and testers environment are displayed by default on admin style v3.
I think we can stop testing legacy version from now on 👍

For invoice feature, I don't know when we will have budget to move forward, so you can also only focus on invoice with toggle OFF.

@drummer83 drummer83 added pr-staged-au staging.openfoodnetwork.org.au and removed pr-staged-au staging.openfoodnetwork.org.au labels Aug 22, 2024
@drummer83
Copy link
Contributor

Hi @wandji20,
Thanks for working on this one!

Here are my testing notes:

Page Invoice Template Action Result
Order list (bulk) Standard Print invoice ✔️
Order list (bulk) Standard Send invoice ✔️
Edit order Standard Print invoice ✔️
Edit order Standard Send invoice ✔️
Order list (bulk) Alternative Print invoice ✔️
Order list (bulk) Alternative Send invoice ✔️
Edit order Alternative Print invoice ✔️
Edit order Alternative Send invoice ✔️

The invoices are sent and printed correctly, the corresponding layout is applied. ✔️

I came across some other issues while testing, but those are not related to this PR.
#12802
#12803

This one is ready to go! Great work! 🎉
Thanks again! Merging! 🚀

@drummer83 drummer83 merged commit 25b1620 into openfoodfoundation:master Aug 22, 2024
54 checks passed
@drummer83 drummer83 removed the pr-staged-au staging.openfoodnetwork.org.au label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants