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

Clean review_entity_summary when reviews are deleted #1103

Merged
merged 2 commits into from
May 18, 2022
Merged

Clean review_entity_summary when reviews are deleted #1103

merged 2 commits into from
May 18, 2022

Conversation

fballiano
Copy link
Contributor

This PR should fix bug #1102

When deleting all reviews of an entity the review_entity_summary isn't cleaned correctly. I tried many different ways to approach the problem but the implemented one seems the easiest and most effective.

Also, the default implementation some of the methods of the Mage_Review modules seem incomplete, they lack the "entity_type" parameters which make the implementations prone to errors when different entities have the same PkValue.

@github-actions github-actions bot added the Component: Review Relates to Mage_Review label Jul 24, 2020
Copy link
Contributor

@sreichel sreichel left a comment

Choose a reason for hiding this comment

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

Tested yesterday and think this PR isn't complete ....

Can you please test again with ...

  • reviews made in backend and frontend
  • reviews with ratings (found some strange behavior here)

@fballiano
Copy link
Contributor Author

sorry to come again on this after so long:

  • tested reviews done in backend and the patch removes the review, the ratings and recalculates the aggregation, so I think it work for this case
  • tested reviews done in frontend (although the review submit form wasn't showing, I had to change app/design/frontend/rwd/default/template/review/product/view/list.phtml to make it appear) and also here it seems that the patch works fine, removing the reviews, the ratings and recalculating the aggregations

Am I missing something?

@addison74
Copy link
Contributor

I created 3 reviews in Frontend and approved them in Backend. In the database table review_entity_summary columns [reviews_count] and [rating_summary] have changed accordingly. In the Backend I changed the rating and in the table the percentage was recalculated correctly. Then I deleted the reviews one by one and also the changes in the table were correct. After I deleted the last review of the product in the table review_entity_summary there was no record for it, which is correct and the issue I reported initially is solved.

Then I created 3 reviews in Backend and I repeated the previous steps, I also didn't find anything wrong, and I didn't find any records in the logs.

If there are no objections to the code, my opinion this commit must be merged.

@addison74
Copy link
Contributor

@fballiano: In table review_entity_summary for a product there are two rows. They differ only in the values on the store_id column, 0 (admin) and 1 (default). Do you know the reason why there is a row for admin?

@fballiano
Copy link
Contributor Author

@fballiano: In table review_entity_summary for a product there are two rows. They differ only in the values on the store_id column, 0 (admin) and 1 (default). Do you know the reason why there is a row for admin?

no idea 😅

@fballiano
Copy link
Contributor Author

fballiano commented May 31, 2021

Admins what can we do to move this forward?

@Flyingmana
Copy link
Contributor

Getting some approving Reviews usually helps.
Shared the PR via twitter to increase its visibility.

@fballiano
Copy link
Contributor Author

@addison74 I think you tested the fix, could you "approve" the PR with green button on https://github.com/OpenMage/magento-lts/pull/1103/files (and then select "approve")?

Thanks!

@addison74
Copy link
Contributor

addison74 commented Jun 22, 2021

@fballiano - I tested it and I didn't find anything wrong, no errors, Your changes solve that initial issue.

Edit - I found the Approve button. Many thanks for pointing me out.

Copy link
Contributor

@luigifab luigifab left a comment

Choose a reason for hiding this comment

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

array( Seems good. )

To clean up data: DELETE FROM review_entity_summary WHERE entity_pk_value NOT IN (SELECT entity_pk_value FROM review)

@fballiano fballiano merged commit fb73d46 into OpenMage:1.9.4.x May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants