Decathlon/vitamin-compose

bug(ratings): Ratings around half value are wrongly choosen

olivierperez opened this issue · 1 comments

Describe the bug

Reading Design System's Rating doc it seemed that the number of stars shown in VitaminRatings isn't correct.

For instance:

  • the value 3.2 is closer to 3.0 than 3.5, so it should show ★★★✩✩ but it is showing ★★★[half-star]✩
  • the value 3.5 is strictly equal to 3.5, so it should show ★★★[half-star]✩ but it is showing ★★★★✩
  • the value 3.6 is closer to 3.5 than 4.0, so it should show ★★★[half-star]✩ but it is showing ★★★★✩

I double checked it by playing with the showcase.

To Reproduce
Show a Ratings with the values given as example above.

Screenshots
Actual ratings of 3.0, 3.1, ..., 3.9, 4.0
image
Excpected ratings of 3.0, 3.1, ..., 3.9, 4.0
image

Smartphone (please complete the following information):

  • Device: One Plus 6
  • OS: Red Velvet Cake
  • Version: 11

Thanks a lot @olivierperez for this complete issue and pull request ! I'll check as quick as possible