-
-
Notifications
You must be signed in to change notification settings - Fork 729
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
Delete dead feature product distributions #3570
Delete dead feature product distributions #3570
Conversation
d1efe7e
to
2149937
Compare
2149937
to
9f0a609
Compare
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.
This is massive @luisramos0 !! IMO is worth digging deeper on the test cases that must be tested. At least, the particular actions and methods that were refactored.
Have we checked if there any recently created openfoodnetwork=> select * from product_distributions order by id desc limit 1;
id | product_id | distributor_id | created_at | updated_at | enterprise_fee_id
----+------------+----------------+----------------------------+----------------------------+-------------------
44 | 4390 | 572 | 2019-02-07 10:19:57.291831 | 2019-02-07 10:19:57.291831 | 95 While from Katuma I get id | product_id | distributor_id | created_at | updated_at | enterprise_fee_id
----+------------+----------------+----------------------------+----------------------------+-------------------
5 | 1008 | 152 | 2019-01-29 17:14:23.109552 | 2019-01-29 17:14:23.109552 | 25 It could as well be that the feature is not really used by we still create these from callbacks without us noticing. Perhaps the client-side is still populating it through |
c99e20f
to
85aef52
Compare
In terms of usage, I dont see any other explanation other than: users are using the product distributions page and selecting enterprises thinking it works, in some way. I think these are all entries created by users that think the page works. I am also saying this because I was one of theses users during a demo in Portugal... later on, looking at the code, I realized the page is useless... |
That would be a feasible explanation. Just out of curiosity I'd check with Matomo what that user did in FR although we know the actions were useless. |
37695e8
to
e59d5b5
Compare
I resolved conflicts and improved the "what to test" description as suggested by @sauloperez |
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.
This is such good work. Well done! It should speed up our tests and prevents us from wasting time with dead code. I got a couple of questions but I'm otherwise very happy with this. It will need some really thorough testing though.
Oh, and we should query all affected enterprises so that we can ask them if they are using it (and why).
@@ -218,10 +218,6 @@ def update_distribution_charge! | |||
line_items.each do |line_item| | |||
if provided_by_order_cycle? line_item |
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.
I'm wondering if this method can go as well. Without product distributions, all items of an order should be in the order cycle of that order, right?
What else could happen? A product can be removed from an order cycle after it has been ordered. Would that cause any problem? Could it be that they disappear from a report?
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.
yes, I think that is one case in which this is protecting against. Products removed from OCs.
I am not sure how the system behaves in terms of modifying orders with products that are no longer in the order cycle, or even modifying orders where the OC is already closed...
I'll add that to the test scenarios of this PR.
@@ -0,0 +1,37 @@ | |||
class DropProductDistributions < ActiveRecord::Migration | |||
def up | |||
drop_table :product_distributions |
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.
Did you run this against production data? Is there any dependent data destroyed?
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.
I tried it now, it just works.
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.
I tried with AUS data.
In terms of enterprises, in AUS live data there's only one enterprise using it and the entries are from 2013, I think we will be ok :-)
|
@luisramos0 yes. Do you have the list? |
yes, just sent you on slack. |
…rs and BO edit page
…tion to avoid deleting fees with product distributions
…ption for that without product_distributions.
…e and deleting some code repeated across data_load and the main action methods
…to use order cycles
2751044
to
786ba15
Compare
rebased, build green, ready for testing! |
We ignore product distributions as it will be deleted soon (see openfoodfoundation#3570) and we do not include stock management from v2 as we will only use the variants edit page to manage on_hand and on_demand
@luisramos0 I've tested all the cases. It seems to me that enterprise fees are not working. Now please take into account that I'm kind of a fee newbie. I've asked Myriam for some detailed test cases but she didn't had the time to write them so far. So I'm sorry but we will have to look at this step by step :( Do you see a step missing in my tests?
Also FYI I've added screenshots in my notes for this. The UI does not allow a user to shop from different shops or from different OC. Meaning 1 order = 1 OC = 1 distributor. It's a bit a pity if you think about it, but this can be dealt with as wishlist items. So you can 🔥 anything related to a different behaviour in the code. Testing notes: https://docs.google.com/document/d/1m_nmQU4Xki5xlHAGeOf-gdbVqIMsTNLpkOT4Ual1zc8/edit# |
Can you be a bit more specific in terms of fees not working? re 1 order = 1 OC = 1 distributor |
In terms of calculators, one important part is that "per order" fees are only seen in cart and checkout, not in the product list. re " I know that packing and transport should appear in the OC, while admin fees are only added at checkout." and thanks a lot for testing this 🎉 |
Not at all. I saw this in an old testing scenario, but I can't find the PR, so let's say I was totally wrong on this.
😊 Could this be I forgot to add them in outgoing? 😱 If it is I'm deeply sorry. However my fee is a flat percent per item set at 50. So in this following screenshot I should see an amount of 1.5 not 2, right? |
you have the fee in both incoming and outgoing, that's 50% + 50%, right ? |
@luisramos0 yes I just saw that. Nevermind, coffee was slow to kick in on this one. Ahem. I'm re-checking all of this right now. |
Alright, I've combined all possible calculators. I didn't see something weird. So I think we are good to go! I've updated the notes. |
great, thanks a lot @RachL :-D |
Sample data was failing since: openfoodfoundation#3570
What? Why?
Closes #3525
I think this is the perfect timing to do this, just before we get to v2.
Product Distributions were an alternative way to get products into the shop list and into the orders. Order Cycle is now mandatory for an order to go through the cart phase.
What should we test?
We need to carefully validate these areas of the app:
In the add to cart stage, there's this scenario where user adds a variant to the cart and then changes to another order cycle where this same variant is also available, from the code it seems this was possible in the past, I am not sure if this a valid user case right now. maybe we should check and decide.
Release notes
Changelog Category: Removed
Remove a feature that was not working: Product Distributions, the predecessor of order cycles.
How is this related to the Spree upgrade?
It's not related.
Dependencies
There will be a conflict with #3569.