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

AverageRatingUpdater is called twice when a review is accepted #16120

Open
martijnc opened this issue Apr 12, 2024 · 1 comment
Open

AverageRatingUpdater is called twice when a review is accepted #16120

martijnc opened this issue Apr 12, 2024 · 1 comment

Comments

@martijnc
Copy link

Sylius version affected: 1.13

Description
The average product rating is updates through AverageRatingUpdater, this service is called by;

  • ReviewChangeListener;
  • the sylius_update_rating callback on the sylius_product_review state machine.

This means that the score is calculated twice for the accept transition; once through the callback and once after flushing the review (which you have to do in order to persist the new state value on the entity).

Steps to reproduce
Accept a review.

Possible Solution
Remove the sylius_update_rating callback from the sylius_product_review state machine. Don't think this is required anymore now that the ReviewChangeListener handles this (was added later).

@Rafikooo
Copy link
Contributor

Hello @martijnc, your reported issue is valid. We will fix it later, in Sylius 2.0 release. However, if you'd like to try your hand at proposing the solution, it would be great. 🕺

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants