TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,910
  • Total Topics: 21,307
  • Online today: 872
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 335
  • Total: 335

Article Ratings Error

Started by clothahump, February 20, 2011, 12:50:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

clothahump

Link to my site: http://www.tropicalfishforums.co.uk
SMF version: SMF ver. RC5
TP version: TP ver. TinyPortal10RC1
Default Forum Language: English
Theme name and version: Default
Browser Name and Version: Firefox?
Mods installed: Not Applicable
Related Error messages: None

Ratings appear to be working but the totals are screwed up, first vote shows as 5 stars, after that any other ratings seem to deduct stars, for example, one article has 10 votes of 5 but it only shows one star.

lurkalot

As far as I'm aware, and I could be wrong.

The rating system takes a average from all the votes, and then rounds it down to the nearest whole number.

So instead of showing 1.5 or 4.5 it will show 1 or 4.

This might have changed though, and as I said I could be wrong.  Hopefully one of the other team members will put us straight on this. ;)

clothahump

I know what you mean Mick but the average of 10 votes at 5 starts = 5 stars surely.

lurkalot

Numbers give me a headache. lol..  :-[

Well I have just tried this on my site, I had two articles with one five star vote on each. 

I gave one another five star vote, and it went down to three stars.

I gave the other a one star vote, and it also went down to three stars.   ???

We'll have to wait for the experts on this one. ;)

WillyP

I think he is saying each of ten people voted five stars... so yes, should be an average of five stars.

If everyone votes five stars, should be an average of five stars. No?

Edit:
Egads, you are right!  I logged into my test site and voted five, which gave a correct rating of five.  I logged out and logged in as someone else, voted five again and now the article has a rating of three!

I wrote a bug report: TinyPortal Bug tracker - Issue #65: Article ratings error

clothahump

Get this one sorted and then we can move on to the next problem.

lurkalot

Quote from: WillyP on February 21, 2011, 02:20:27 AM
I think he is saying each of ten people voted five stars... so yes, should be an average of five stars.

If everyone votes five stars, should be an average of five stars. No?

Edit:
Egads, you are right!  I logged into my test site and voted five, which gave a correct rating of five.  I logged out and logged in as someone else, voted five again and now the article has a rating of three!

I wrote a bug report: TinyPortal Bug tracker - Issue #65: Article ratings error

Cheers for doing the bug report.   O0   Something clearly wrong with the voting system.

IchBin

Find in TPortal.php about line#677

                    // allowed and all is well, go on with it.
                    $context['TPortal']['article'] = $article;


Add after the code above, this code:
                    $context['TPortal']['article']['rating'] = array_sum(explode(',', $context['TPortal']['article']['rating']));

Just to note, TP rounds the votes up. If the number of votes divided by the number of voters is something like 4.3 it rounds the average votes up to 5.

lurkalot

Quote from: IchBin on February 22, 2011, 05:45:27 AM

Just to note, TP rounds the votes up. If the number of votes divided by the number of voters is something like 4.3 it rounds the average votes up to 5.

Thanks for that info Brad.  Now I knew I'd read it somewhere, and took me a while to find it, but the reason I said rounded down was because I had this in my head for some reason, http://www.tinyportal.net/index.php?topic=30746.msg245459#msg245459

clothahump

Are all these fixes being implemented in the download of TP?

This website is proudly hosted on Crocweb Cloud Website Hosting.