WordPress.org

Making WordPress.org

Opened 7 months ago

Last modified 7 days ago

#2606 assigned defect

Inaccurate plugin rating counts

Reported by: svenl77 Owned by: Otto42
Milestone: Plugin Directory v3.0 Priority: normal
Component: Plugin Directory Keywords: needs-patch
Cc:

Description

I found a wired behave in the new plugin directory. Deleted spam reviews still get counted

Example: https://wordpress.org/plugins/bp-wc-vendors/ the two 1 star have been deleted but still get count

Change History (7)

#1 @netweb
7 months ago

  • Keywords needs-patch added
  • Summary changed from Deleted spam reviews still get counted to Inaccurate plugin rating counts

Welcome to Trac and thanks for the ticket @svenl77

To clarify things a little further, currently there are two 5 star reviews, and three 1 star reviews that have been "archived". The plugin page shows two 5 star reviews and two 1 star reviews, it should show only the two published 5 star ratings, the same as the reviews page.

This is also only an issue on the plugin page: https://wordpress.org/plugins/bp-wc-vendors/

  • https://cldup.com/TGqDzKEcVe.png

The plugin correctly only shows only the two 5 star reviews on the review page: https://wordpress.org/support/plugin/bp-wc-vendors/reviews/

  • https://cldup.com/O0x6B4bm_s.png

#2 follow-up: @Otto42
7 months ago

  • Owner set to Otto42
  • Status changed from new to assigned

This is because the get_star_rating function is using the post_meta, when it should be calling the existing and centralized ratings code to get the information correctly. Said ratings code also contains the necessaries to create the HTML for the bars, so some simple de-duplication of code should fix this.

This ticket was mentioned in Slack in #meta by ipstenu. View the logs.


6 months ago

#4 @keraweb
6 months ago

What is the status for this issue? I have the same thing with one of my plugins. The WP.org API returns the archived/spammed reviews as well.

This ticket was mentioned in Slack in #meta by dd32. View the logs.


6 months ago

#6 in reply to: ↑ 2 @SergeyBiryukov
7 days ago

Replying to Otto42:

This is because the get_star_rating function is using the post_meta, when it should be calling the existing and centralized ratings code to get the information correctly.

It used to call WPORG_Ratings methods via Plugin_Directory::filter_shim_postmeta() before [4420], but apparently post meta fields are necessary for search indexing.

Looking at Meta_Sync::sync_ratings(), the post meta is supposed to be synchronized with WPORG_Ratings data hourly, so the information should eventually be correct, even though there is some delay.

To reduce confusion and avoid discrepancy between the ratings on support forums and on plugin page, we could probably trigger a sync right after a review is archived or marked as spam.

#7 @SergeyBiryukov
7 days ago

On second thought, switching Template::get_star_rating() back to using WPORG_Ratings methods might indeed be easier. WPORG_Ratings is not open-sourced yet, so I'm not sure which way is better in terms of performance, but the same methods are used on support forums, so it would at least bring parity.

Note: See TracTickets for help on using tickets.