-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
[Spree Upgrade] Delete Accounts and Billing dead feature code until we decide we want to start using it again #3321
[Spree Upgrade] Delete Accounts and Billing dead feature code until we decide we want to start using it again #3321
Conversation
92ab1a7
to
8175a9e
Compare
b7e8e83
to
bb1868d
Compare
4447 lines of code... |
ah, nice, the build is good now. |
bb1868d
to
ffa29a0
Compare
rebased, green build ;-) |
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.
@luisramos0 I did some grepping for removed helper methods that are not just for a resource, and noticed that free_use?
is still used in the code but is no longer defined. It's just in a view template.
In my understanding, we would be keeping the account and billing data in the DB, but we would no longer be able to "use" these features. Is this correct? If yes, some questions:
- Are we keeping the
Spree::Preference
records that we no longer use? I think they should be removed and should just be set again if we put back the removed code. If not, we risk complexity when we happen to use the same key with a different data type or purpose in the future. - What about DB records for pending or failed DJ jobs? Bringing this up because a project I worked on had many failed jobs for a job type that was no longer defined in the code. I think these should be removed.
- Some places that used to exclude platform billing Customer records (
Customer.of_regular_shops
) would now show these Customers. I think this is okay, but have you checked that this would not result in an error? For example, if we presume certain data is present, but it is missing. - How will order pages for existing platform billing orders look now? Some adjustments would have
source_type
ofBillablePeriod
, butBillablePeriod
is no longer be defined. - Is there anything users should ensure before they upgrade? For example, that all existing platform billing orders have been processed. I think this should be included in the release notes.
Nice, thanks for the review @kristinalim
Summary, I'll add code to:
does this sound good @kristinalim ? |
actually, regarding point 2 above, what are pending jobs? 😊 I looked at table delayed_jobs in both AUS and UK but there's nothing there related to this PR because all jobs just run and are deleted. what do you think? |
420a7fc
to
ca12460
Compare
ok, I've added a new commit to delete preferences and adjustments. |
@luisramos0 For pending jobs, just the ones that have not been processed yet before the upgrade (e.g. if there is a long queue of jobs). For failed jobs, we've set DJ not to delete failed jobs. It's great if none of these jobs have failed in the past though.
Sounds scary, but sounds like it's the best path. Maybe the instances could also be asked to export the order data for this accounts enterprise before the upgrade? Because, for example, callbacks might update the order totals if we
OFN is still open source software which is free to be used by all, and some instances we don't know about might be using this feature. Aside from a warning in the release notes that this feature would be removed, actually, I think an additional note that these records would be removed and that they should export order / adjustment data for this accounts enterprise would be sufficient and requires small enough effort. What do you think?
@luisramos0 This too, by the way. 🙂 |
ca12460
to
b91207d
Compare
re delayedjobs, I think we probably want to have a Delayed::Job.destroy_all before the migration? shall I do that instead? re release notes, good points, I agree, I drafted it in the description of this issue. We need to see what kind of release notes v2 will have! I am sorry, I have missed your comment about free_use? |
This sounds good to me. A separate issue? |
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.
Looks good to me now, @luisramos0!
@sauloperez I'll request redo of review from you.
…ithout business models and account invoices
b91207d
to
0501db1
Compare
thanks guys 👍 |
@luisramos0 other than not seing the menu in configuration, is there something else to test for this particular PR? I've notice that now Invoice settings have an error 500 https://staging.openfoodfrance.org/admin/invoice_settings/edit could this be linked to that PR? |
I am sorry I completely missed the "what to test" part of the PR. I think #3551 is relates to this PR. We need to test different things:
We also have to validate reports, but we will have to do that later when reports are working in v2 But let me have a look first at #3551 |
ok, so invoice settings are back (this PR was removing that by mistake). I confirmed #3551 is not related to this PR :-) I'll explain there what I found. So, this is ready for testing again 👍 |
Testing blocked by #3561 Note to myself: testing notes template: https://docs.google.com/document/d/1YkmXg5RYLKmDiTdQrWsYNfHDb-kartNwc84CewDUhNE/edit# |
@luisramos0 before FR staging crashed, I couldn't get an order confirmation email. Not sure yet if it was linked to staging or to the PR. Also I couldn't ship an order. I did a last test with Sally's distributor to see if it was linked to my producer. Need to check this and invoices when staging will be back. The rest seems to look good. |
@luisramos0 order emails are not sent anymore (registering and shipment still good), so this is back to you. I manage to ship an order by placing it on Sally's distributor. I think there might be something missing for my producer, so I need to check that. |
Hey @RachL delayed job is not working properly in staging FR, that's the reason emails are not going out (I see them in the logs). We need to rebuild staging FR... |
I deployed this v2 branch to katuma staging and the emails are working fine. So, this is ready for re-testing. |
@luisramos0 When I'm editing a product, I cannot update stock info anymore. But I see this on staging FR as well. So I'm guessing this is a general v2 bug and not linked to this PR. Am I correct? Also I'm still struggling to ship an order with a new account (same as in staging FR). I will create new issues for both. |
yeah, thanks. these issues will not be related to this PR. does that make this PR ready to go? |
@luisramos0 yes |
awesome, thanks! |
Please read the discourse thread about this PR: https://community.openfoodnetwork.org/t/ofn-v2-account-invoices/1548
What? Why?
Closed #2684 and #2918.
From spree upgrade phase 2 issue #2918, I realized this feature has not been used in the last 2 years. Last invoices are from 2016.
There's some effort involved in making this work in v2.
I believe this should be external to OFN, not part of the OFN code base.
I recommend we delete this code until we decide to use this feature again, when we decide that this feature should be moved to a separate engine.
This is a significant part of the OFN complexity, 4000 lines of smart code, so deleting this and forcing it out of the code base into an engine is a great step towards making OFN simple.
Alternatives
Releasing v2 with these specs commented out is not an option, I think we either fix it or delete it. This PR can be reverted easily later when/if we decide to make it work (in v2.1 for example).
So, the only alternative to this PR is to fix the account invoices feature in v2.
Releasing OFN v2 with this feature broken and commented specs is not a valid option.
Opinion
From what I read in slack, I think we should delete this and any other feature that is not being used and is not at the top of our priorities.
https://en.wikipedia.org/wiki/Muda_(Japanese_term)
"one of the three types of deviation from optimal allocation of resources"
Release Notes
Change Type: Removed
Business Model configuration, Account Invoices and Trial date control was removed after 3 years of no use. This feature may come back renewed in the near future.
All the preferences and adjustment records (with the invoice values) will be removed from the database when the database is migrated to v2. You should export the account invoices data before you upgrade (DB table spree_orders with distributor_id equals to the accounts distributor ID, the DB table spree_adjustments where source_type equals 'BillablePeriod' and the DB table spree_preferences).