-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Implemented toplogical sorting for totals #65
Conversation
Hi Amenk. It has already a fixed solution with integration test that confirmes that fix is working. |
Hi Ivan, thanks for the comment - I wish I saw that pull request earlier... Alex |
@amenk Recently (see pull request #49) we have implemented a library |
Okay. Can you give me a ping as soon as the Magento_Data_Graph is available in the git - I did not find it. But I think the "drawback" of using the topological sort will be that if the ordering is not possible it would fail. See the discussion in #49 - so I do not know if it will be possible to still "sell" if there are problems. |
I will try to implement a check when sorting the data as an addition to #49 and log an exception when there are contradictions. |
Hello Amenk, any luck with implementing this one? |
Did not have a time yet. I thought again about your suggestion in the other ticket to implement it in a CI test. Not sure about that. I think if I integrate it with the Magento_Data_Graph you would use my functionality only to verify and log an exception but use Ivan's patch to do the actual sorting? Is such a double-check and double-sorting intended ? What do you think? |
In the particular case with checkout -- yes, we'd have to use this algorithm only to verify and log an exception. But also we intend to utilize topological sorting in future for other places:
|
|
Alright. What algorithms are used in those cases currently. Please be aware, that the algorithm I suggest will fail if there are any contradictions. (which I do not think is a problem - but basically the discussion is the same like in #49) You mentioned also sales totals - isn't that the same use case? |
Here's the code for sorting one way, |
I actually used the code from http://www.calcatraz.com/blog/php-topological-sort-function-384 which is without license, means public domain. |
Right. It was listed there by mistake, please disregard that part. |
Hi. Would you be able to contribute topological sorting in Magento_Data_Graph? (and if you can add test/cases that would be great) |
Closing the thread due to no recent activity. |
[Mavericks] Convert all fixtures/repositories for functional tests into *.xml files
MAGETWO-44707: Remove @api sign from CatalogInventory module
MQE-1068: Require Issue ID for Skipped Test
The sorting of totals is incorrect with causes lots of problem when new modules that define own totals are added.
For details see http://stackoverflow.com/a/9258826/288568
This patch implementes a toplogic sort to fix this problem.
For a unit test I suggest the following code ($result is the result of the _getSortedCollectorCodes array for any input)