Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rating of less than 5 icons doesn't behave as expected #37

Open
jkutianski opened this issue Jan 19, 2023 · 2 comments
Open

Rating of less than 5 icons doesn't behave as expected #37

jkutianski opened this issue Jan 19, 2023 · 2 comments

Comments

@jkutianski
Copy link

I'm trying to set 3 start, but the value is 5.

image
image

In some cases, the stars are not marked

image

@laurencepike
Copy link

laurencepike commented Mar 9, 2024

I'm seeing this as well, seems that while the icon count was reduced the actual rating is still done 1-5. This means that the value returned is actually a fractional value. 2 out of three stars for example corresponds to 2/3 * 5 = 3.33 recurring.

To work around this issue I'm multiplying the rating by 5/9 and then Math.round()

Math.round(rating * 5/9)

@mo-hassann
Copy link

First make sure that you added the allowFraction property to your element. When you use 3 starts the value or the rating must be from 0 to 3 so you can convert it using this equation: (value of rating from 0 to 5 / 5) * 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants