Broken article caused by wrong average rating
-
Hi,
First of all, thanks for your plugin and for any future reply.
I use your plugin on my website with rmp_max_rating limited to 4 (it has never been changed).
I saw this fatal error opening some rare articles:PHP Fatal error: Uncaught ValueError: array_fill(): Argument #2 ($count) must be greater than or equal to 0 in /var/www/html/wp-content/plugins/rate-my-post/public/class-rate-my-post-public.php:1846
After futher investigation, I found that it was caused by:
$icons_empty = $max_rating - $icons_highlighted - $icons_half_highlighted;
On one article,$max_rating
was 4 and$icons_highlighted
(that is floor($average_rating)) was 4.6, but the problem is the same on the other ones.
For example, in one article the postmetas are:rmp_vote_count = 5
rmp_rating_val_sum = 23
rmp_avg_rating = 4.6
And these are the analytics.In another one, the postmetas are:
rmp_vote_count = 1
rmp_rating_val_sum = 10
rmp_avg_rating = 10
And these are the analytics.
I could recalculate the metas using the analytics data, but I don’t know how this could have happened.
Thanks
- You must be logged in to reply to this topic.