-
Notifications
You must be signed in to change notification settings - Fork 247
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
#518 Simplest “By Priority” Algorithm implementation #560
#518 Simplest “By Priority” Algorithm implementation #560
Conversation
…s in priority order
*/ | ||
private function isZero(float $floatNumber): bool | ||
{ | ||
return $floatNumber < 0.0001; |
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.
it's a pity that Constant has been added just in PHP 7.2
PHP_FLOAT_EPSILON (float)
Smallest representable positive number x, so that x + 1.0 != 1.0. Available as of PHP 7.2.0.
Please, make the precision a bit less, like 0.0000001
…selection-algorithm' into 518-priority-adjustments-simple-selection-algorithm
…518-priority-adjustments-simple-selection-algorithm
…selection-algorithm' into 518-priority-adjustments-simple-selection-algorithm
* | ||
* @return SourceItemInterface | ||
*/ | ||
private function getStockItemBySku(string $stockCode, string $sku): SourceItemInterface |
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.
Description talks about one behavior
Method name talks about another behavior
Implementation return the other
Also, you can reuse \Magento\Inventory\Model\SourceItem\Command\GetSourceItemsBySkuInterface
* {@inheritdoc} | ||
* This shipping algorithm just iterates over all the sources one by one in priority order | ||
* | ||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
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.
We should not add suppressing in new code (only in special cases)
We can split this class on a few, first is loading data, second is perform algorithm
…tments-simple-selection-algorithm
Implement shipping selection algorithm by source priority.
Fixed Issues
To Do