Skip to content
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

Refactor catalog promotions - process variants instead promotion #13536

Merged
merged 15 commits into from
Jan 31, 2022

Conversation

AdamKasp
Copy link
Contributor

@AdamKasp AdamKasp commented Jan 25, 2022

Q A
Branch? 1.11
Bug fix? no
New feature? no
BC breaks? no
License MIT

to make it possible to optimise Catalog Promotions processing, we want to process catalog promotion per variants in batches. the current solution prevents parallelization of the work.

it is initial PR.

@AdamKasp AdamKasp requested a review from a team as a code owner January 25, 2022 13:27
@AdamKasp AdamKasp changed the title [WIP]Refactor catalog promotions - precess variants instead promotion [WIP]Refactor catalog promotions - process variants instead promotion Jan 25, 2022
@AdamKasp AdamKasp changed the base branch from master to 1.11 January 25, 2022 13:37
@probot-autolabeler probot-autolabeler bot added Documentation Documentation related issues and PRs - requests, fixes, proposals. Maintenance CI configurations, READMEs, releases, etc. labels Jan 25, 2022
@AdamKasp AdamKasp force-pushed the catalog-promotion-refactor branch 2 times, most recently from 89ae455 to 39beb76 Compare January 26, 2022 07:02
Copy link
Member

@lchrusciel lchrusciel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General problem, that exist with this implementation is the usage of CatalogPromotionApplicatorInterface - this service is checking only for exclusiveness or minimum price, both on channel pricing, but (if I see correctly) we are never checking scopes of promotions if they should be applied. At least, I don't see VarinatProvider usage here nor reimplementation of it. This suggest, that we have weak test coverage if we didn't detect it earlier

@AdamKasp AdamKasp force-pushed the catalog-promotion-refactor branch 5 times, most recently from 526a744 to 9d2b663 Compare January 27, 2022 08:47
@AdamKasp AdamKasp force-pushed the catalog-promotion-refactor branch 2 times, most recently from 6a89290 to ebb2131 Compare January 27, 2022 11:42
Copy link
Member

@lchrusciel lchrusciel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should probably slowly remove variants provider.

@AdamKasp AdamKasp force-pushed the catalog-promotion-refactor branch 9 times, most recently from 495c41c to b9a9609 Compare January 28, 2022 12:04
Comment on lines +34 to +40
# @api @ui @todo
# Scenario: Enabling catalog promotion during its operating time
# Given the catalog promotion "Christmas sale" operates between "yesterday" and "tomorrow"
# And this catalog promotion is disabled
# When I enable "Christmas sale" catalog promotion
# Then this catalog promotion should be active
# And "PHP T-Shirt" variant should be discounted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`todo tag should be enough. Please revert. If the tests will be still executed, we need to improve GH Action step

interface ForVariantInCatalogPromotionScopeCheckerProviderInterface
{
public function provide(CatalogPromotionScopeInterface $scope): VariantInScopeCheckerInterface;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

use Sylius\Bundle\PromotionBundle\Provider\EligibleCatalogPromotionsProviderInterface;
use Sylius\Component\Core\Model\CatalogPromotionInterface;
use Sylius\Bundle\CoreBundle\CommandDispatcher\ApplyCatalogPromotionsOnVariantsCommandDispatcherInterface;
use Sylius\Component\Core\Repository\ProductVariantRepositoryInterface;

final class AllCatalogPromotionsProcessor implements AllCatalogPromotionsProcessorInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
final class AllCatalogPromotionsProcessor implements AllCatalogPromotionsProcessorInterface
final class AllProductVariantsCatalogPromotionsProcessor implements AllProductVariantCatalogPromotionsProcessorInterface

@lchrusciel lchrusciel changed the title [WIP]Refactor catalog promotions - process variants instead promotion Refactor catalog promotions - process variants instead promotion Jan 31, 2022
@lchrusciel lchrusciel merged commit bf579b4 into Sylius:1.11 Jan 31, 2022
@lchrusciel
Copy link
Member

Thank you, Adam! 🎉

@AdamKasp AdamKasp deleted the catalog-promotion-refactor branch January 31, 2022 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation related issues and PRs - requests, fixes, proposals. Maintenance CI configurations, READMEs, releases, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants