Here's an example:
When using a 7 star voting widget, a user gives a piece of content a 1 star rating. Each star equals 100 / 7 = 14.285714285714286 percent. This gets rounded up and stored as 15 through VotingAPI. When the average number of stars are calculated this comes to 15 / (100 / 7) = 1.05, which is rounded up to 1.1. So 1 vote of 1 star gives you an average of 1.1 stars.

An easy fix is to remove 3, 6, 7 and 9 stars as options. I guess another way would be to add a custom tallying function that adjusts the maximum according to the set number of stars. That would make it difficult to make a change to the number of stars later though.

Comments

quicksketch’s picture

Other than the cosmetic problem of a vote of one star registering 1.1 stars, this doesn't seem like too bad a problem. Since after a second vote is registered the average will rarely be an integer ever again.

The real fix we need here though might be greater precision in the recording of VotingAPI votes, at least to a few decimal points.

ericduran’s picture

Status: Active » Closed (cannot reproduce)

This issue is almost 4 years and on an unsupported version of drupal. I'm just going to assumed if fixed, if not feel free to open up the issue again.