Rating calculation is not correct



addons.mozilla.org Graveyard
Public Pages
13 years ago
2 years ago


(Reporter: Alfred Kayser, Assigned: morgamic)






13 years ago
For Nautipolis for Firefox, there are 6 ratings with all 5 stars, but the
rating says that the overall rating is 3.2 stars out of 5.

This is probably due to some 'deleted/disabled' comments about installation issues.

Can this be please be fixed? 
Right now my themes get a ridiculous low rating because of this issue.

Comment 1

13 years ago
Edit: actually 4 * 5 stars, and 2 * 4 stars, which should make the average to 4.7

Comment 2

13 years ago
The rating at the top of the page, is generated from the last 30 days worth of
comments, not all comments.

I am of the opinion this is wrong, but it appears to be the way that the page is

Kveton, Morgamic: Should this be pushed out to 2.0; we seem to be storing the
last 30 days average in the Database seperately from all the ratings - in main
v. feedback?


13 years ago
Target Milestone: 1.0 → 2.0
Note bug 296541, another way for overall ratings to get out of sync with comments.

Comment 4

12 years ago
> The rating at the top of the page, is generated from 
> the last 30 days worth of comments, not all comments.

If this is the case, then it's still not working properly.  The rating for RSS Ticker (https://addons.mozilla.org/firefox/2325/) has been stuck at 4.44 for what seems like forever, but I just went through the last 30 days of comments and calculated that the rating should be 4.73 (104/110).

Is the rating updated with every new comment, or is it just updated every 30 days to use only the last 30 days of comments?

Comment 5

12 years ago
The solution may be a 2-part one.  I think they may have made it update every 30 days for load purposes (guessing here).  From my testing, though, updating the rating lookup in main when a new comment is added to feedback doesn't seem to be a huge operation.  The query could be:
    update main set rating = (select avg(commentvote) 
    from feedback where id=220) where id=220;

Query seemed to be pretty quick for flashgot, which has >2200 comments (0.15 seconds).

On the other hand, it would be easily thrown into maintenance.php as an additional maint. task to update all main.rating values nightly (or hourly).  That may not be necessary though.

I think I will update the comment page so it updates the main.rating lookup after inserting.  I don't think we'll lose a whole lot.  Only problem with that might be loss of rounding when moving from a decimal to a varchar(4)... MySQL didn't like that conversion a whole lot (as it shouldn't).
Assignee: Bugzilla-alanjstrBugs → morgamic
Summary: Rating calculation is (still) not correct → Rating calculation is not correct
Target Milestone: 2.0 → 2.1

Comment 6

12 years ago
AMO bugspam. Correcting QA contacts on OLD bugs (mozilla.update@update.bugs)

-> Correct QA contact (web-ui@add-ons.bugs)

QA Contact: mozilla.update → web-ui
Target Milestone: 2.1 → ---

Comment 7

11 years ago
AMOv2 specific bug; closing.
Last Resolved: 11 years ago
Resolution: --- → WONTFIX
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.