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 migration to fix calculator preferences #5799
Conversation
Hi @luisramos0 , I could not reproduce the issue on the Fredo's Farm Hub, in staging-FR. It had a flat percent (10%) on a shipping method (Home delivery), with an invisible tag set. So this shipping method was not appearing in the shopfront. Other pick-up option had zero fees set, and other enterprise fees were applied equally, before and after staging. I avoided editing these settings explicitly, as editing would probably refresh the DB and show/apply the fees correctly. Anyway, all looks good before after staging. I will leave this PR in test ready for now, and try to find a shop, on another staging server, with shipping fees set, see if I can verify the issue later on. |
"UPDATE spree_preferences pref SET key = " + updated_pref_key + | ||
" WHERE pref.key like '" + from_pattern + "%'" + | ||
" AND NOT EXISTS (SELECT 1 FROM spree_preferences existing_pref | ||
WHERE existing_pref.key = " + updated_pref_key + ")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's blank spaces either side of the string in these keys?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you ask? no blank spaces, just more characters like the name of the fee (flat_rate for example), that's why we need the %.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you are looking at updated_pref_key and thinking it's a string? updated_pref_key is a call to the replace function and so it can have spaces before and after.
A quick update: I tried to reproduce the issue as well on an old "untouched" hub in staging-katuma, but still no success: the fees appear in the order total, and are charged as expected. So I did not notice any hub whose settings were set to zero... This is similar to the issue we observed to Katuma, in production - right? I can't recall having seen any setting misplaced in staging servers, other than missing images. Can we pin-point such a case, in staging? After review comments are addressed I'd move this to ready to go. |
…pp picks the new values immediately
yep, all checked and nice in AUS, I run the same test as described above for an enterprise with existing fees and it all worked after the deployment of this new version. Merging now. |
Just to be clear: this is a release blocker, that's why I merge now. We can address anything that we find out with @Matt-Yorkley s comment above on a separate PR. |
Awesome @luisramos0! Thank you for documenting this, reproducing the issue and double checking it now works - glad you did. Thanks. |
What? Why?
Closes #5795
This will change all adjustments config in spree_preferences to the new calculators without the Spree namespace.
What should we test?
Before staging this PR you should replicate the problem, for example, in FR staging now in fredo's farm hub shop the 10eur shipping fee are not applied:
https://staging.openfoodfrance.org/fredo-s-farm-hub/shop
I am pointing this one out because not all fees are broken (all the fees that have been edited manually since v3 release will be working correctly).
You need to test this with existing fees on the server, you cant edit any fees otherwise the problem is gone.
After this PR is staged the fees should be applied again.
Release notes
Changelog Category: Fixed
Fixed a data migration bug in a recent change to fees calculators where fees were not applied at checkout.