- This topic has 5 replies, 2 voices, and was last updated 9 years, 11 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
Tagged: average calculation
I have my system setup so comments must be approved manually so they don’t show on the site until they’ve been moderated. But it seems the average rating is including ratings for pending comments. Even worse, it’s including ratings for deleted comments.
Thanks.
Hi Jim,
Can you double check that it’s calculating deleted comments? Were those comments published? I remember we addressed the delete issue in the past, so want to confirm before alerting our dev team
___
BePro Software Team
Hi,
Yes, I just confirmed. I had put the comment in the trash and the average rating still included it. I just tried emptying the trash and the average is still wrong. Here’s an example:
http://www.boardandcareca.com/board-and-care-homes/compassionate-eldercare-rcfe/#undefined2
There is only 1 rating here of 3 stars, but the average rating shows 5 stars. There are no pending comments and nothing in the trash so it appears the rating record is left orphaned and is still being included in the average.
I don’t have the list of tables in front of me, but I believe the SQL statement for the average rating needs to be changed to join on the comments table where the comment status is approved. The average rating should only include ratings for approved comments.
Thanks,
Jim
Hi,
Thanks for clarifying. Those terminologies really make a difference. Our fix was focused on listings that are deleted, not trashed. As you noted, we do not monitor the status of the comment. If the comment is deleted, then the rating is deleted.
I definitely understand your perspective. If you believe the delete feature doesn’t fit your needs, we can add status monitoring to our development plan. An sql join does sound like a potential fix that the community may appreciate
___
BePro Software Team
I went ahead and made this trivial fix myself.
File: /wp-content/bepro_listings_reviews/bepro_listings_reviews.php
Line 245 changed to:
return $wpdb->get_row(“SELECT COUNT(post_id) as num_results, SUM(rating) as rating FROM “.BEPRO_LISTINGS_REVIEWS_TABLE.” JOIN wp_comments USING (comment_id) WHERE comment_approved = 1 AND post_id = “.$post_id);
Now only approved comments/ratings are included in the average rating. If they are pending, trashed or deleted they are not included.
– Jim
Hi,
Glad to hear you are making progress for your needs.
For us, a fix is never trivial. We have thousands of customers to consider with every change. We must consider the expectations of existing users, with every new individual request. In addition, we have over 20 addons that need to cohesively work together to manage large numbers of listings.
Thanks for sharing your fix. Our development team will evaluate the code and if its accepted, schedule it for inclusion and release.
___
BePro Software Team
Stay up to date on web design and development trends. Also receive updates on video tutorials, services, deals, products, and discounts offered by the BePro Software Team. to sign-up for our newsletter today.