Option to rate in half star increments
vzey - July 13, 2007 - 15:36
| Project: | Fivestar |
| Version: | 6.x-1.14 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Hi guys.
I would love to have the option to rate in half star increments. So there would be 10 options all together for 5 stars. These being
0.5 - 1.0 - 1.5 - 2.0 - 2.5 - 3.0 - 3.5 - 4.0 - 4.5 - 5.0
I guess I don't actually need it to rate like that, if there is a way to use the 10 star option, but graphically make it look like you are rating in half star increments that will do fine too.
These guys have some none drupal ideas on it
http://examples.learningjquery.com/rating/
Cheers.

#1
I really need this, but don't know how to make it work.
What if there was a way to use the 10 star option, and have each alternative star show up as half, and just put each pair close together to give the illussion of having five stars? There must be some smart cookie out there who can make this happen :)
#2
Yup, there's an 'even' and 'odd' CSS class put on every star, so you just have to write the css necessary to display the first half of a star on every odd star and the second half of a star on the second have and then you'll have voting in halves.
#3
you can setup a 1-10 schema with css as quicksketch suggests. so it will look like you can vote with half stars. but unless you fiddle some more, your ratings will be recorded as with scores up to 10, and not 5. so appearance fiddling is not enough I think. needs some code changes.
#4
Agreed. This would be useful to me as well. I'm considering offering to help someone convert his movie-reviews site to drupal, and he rates in half-star increments. I fear this not having this feature will be a deal-breaker.
#5
All results are stored in VotingAPI from 1-100, so the number of stars you use doesn't affect the data storage. In a 5 star system, 1 star is stored as 20. In a 10 star system, 2 stars are stored as 20 (3 stars as 30). No code changes should be necessary other than CSS changes.
#6
The module would have to be modified if you wanted to use half star ratings. Using Css you can successfully change the stars to look like half stars and it functions pretty well but the first problem I ran into is when the average is calculated for the stars. When the average is calculated the fivestar.js adds a style="width: 50%" which will make your stars 1/2 smaller and when they are already 1/2 smaller it will make them 1/4 the size destroying appearance. Also you would have to change the code that displays the averages because using a css only method would store the vote as an 8 when it is supposed to be a 4. And a vote of 4.5 would be stored as a 9 and when 8 and 9 are average together the average that is displayed is 8.5.
#7
I haven't tried this yet but this sounds like a big problem: When the average is calculated the fivestar.js adds a style="width: 50%" which will make your stars 1/2 smaller and when they are already 1/2 smaller it will make them 1/4 the size destroying appearance.
Anyone have some css to share in general?
#8
Last night i ended up implementing this.
What I did was create two different sets of stars (the right half and the left half) -- then I used the Craft stars as a base because they were the only one that was using different images for each star. I then changed which images are referenced so all the odd numbers use the left side, the even numbers use the right side. (there was a little more with changing the width so they're all the same, etc).
Pretty simple once I figured out what I was trying to do...
#9
Hello everyone,
It seems that it only takes a modification of the .css to get half star increments.
I use it for reviewing books and movies, so user don't vote.
May you please be so kind as to share the code that should be changed or added in the .css ?
It would be very much appreciated!
Thank you.