Page MenuHomePhabricator

VoteNY doesn't round off votes early enough and results in long decimals
Closed, ResolvedPublic

Description

And, 4.5 stars gives 4.666666666666667 instead 4.5.

Event Timeline

SamanthaNguyen moved this task from Backlog to Bugs on the VoteNY board.Jan 26 2017, 10:58 PM
Filip added a subscriber: Filip.Oct 31 2017, 6:37 PM

This looks like a good task for Google-Code-in-2017

Filip added a comment.Oct 31 2017, 6:56 PM

Hmm, looks like the problem is in Vote.class.php. number_format should do the job.

Filip added a subscriber: Aklapper.Nov 3 2017, 4:52 PM

Its simple task, I can mentor it @Aklapper

Zppix added a subscriber: Zppix.

Thanks @Filip

MtDu added a subscriber: MtDu.Nov 5 2017, 7:46 PM

@Filip Since you're familiar with this extension, can you add some more details, similar to what people have done in https://phabricator.wikimedia.org/T179691?

Filip added a comment.Nov 11 2017, 9:14 AM

@MtDu I'll add some details in GCI task description

Filip added a comment.EditedNov 11 2017, 9:41 AM

To recreate this issue

  • Create new article with <vote type=1/> inside
  • Vote for article with votes giving rational number in average
  • On page Special:TopRatings you can see all ratings, check if this issues still occurs
  • Fix it (propably by using number_format) send patch to gerrit

Added this task to GCI board.

takidelfin closed this task as Resolved.Nov 29 2017, 4:03 PM
takidelfin claimed this task.
takidelfin added a subscriber: takidelfin.

This issue was fixed.

I tried to recreate this issue, but it was fixed.
Version of plugin: 2.9.2 from 2017-09-21
I voted at four test users.
Ratings: 1,2,5,4

Article view:

Special Page view (Special:TopRatings):

And I tested with one rating, too.

Filip added a comment.Nov 29 2017, 4:23 PM

Tested it out, looks like this issue got fixed before. I accepted this task on GCI dashboard

Reedy added a subscriber: Reedy.Nov 29 2017, 4:25 PM

Are you sure it's fixed? @SamanthaNguyen what version was it on at the time?

From what I can see, the code hasn't been touched in quite a few years... https://github.com/wikimedia/mediawiki-extensions-VoteNY/blame/0131e6940d6b9c76bf698dd38a0ade2db0a45282/includes/Vote.class.php#L67-L92

And your votes haven't done anything that would trigger a recurring number

Yes, I'm sure. I tested many variations of ratings.