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.

pasted_file (738×1 px, 119 KB)

Event Timeline

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

@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?

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

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
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:

image.png (77×305 px, 5 KB)

Special Page view (Special:TopRatings):

image.png (135×279 px, 8 KB)

And I tested with one rating, too.

image.png (131×235 px, 8 KB)

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

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.