Closed (works as designed)
Project:
Fivestar
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
29 Jul 2011 at 09:46 UTC
Updated:
13 Apr 2017 at 18:05 UTC
Jump to comment: Most recent
Comments
Comment #1
Anonymous (not verified) commentedOK, I got it - been a few years since I hooked up voting!
For reference, this Lullabot video helped:
http://www.lullabot.com/node/425/play
I added a relationship of Content: Vote results, setting 'Value type' to 'Percent'; 'Vote tag' to 'Vote'; and 'Aggregation function' to 'Average vote'. I didn't set the 'Require this relationship' so I see items which don't have any votes too.
Then I added a field 'Vote results: value' with the above relationship, and set the appearance to be 'Fivestar (clickable, with text)'
Lastly I added a sort on 'Vote results: value' desc, again linked to the above relationship.
One thing I noticed during the process is the 'Vote results: value' field is described as 'The value of an individual cast vote.' which threw me a bit!
Comment #2
ruess commentedThanks for this video link Steve.
Working on my D7 site, I found that the "appearance" element in Views that the video refers to doesn't seem to be found anywhere in Views 3, thus making it difficult to get the actual rating stars in a table column.
The approach I found to use was as follows:
1) As per the video, add the relationship: Content: Vote results and select "Value Type: Percent; Vote Tag: Vote, Aggregation function: Average"
2) Add the field: Content: Rating, but check "Exclude from display" - this column allows us to show the star rating, but because it does not include the actual average vote value, it does not correctly sort your results by top rating. Thus, we'll exclude it from displaying, but still need it there as you'll soon see
3) Add the field: "(Vote results) Vote results: Value (Rating)" and AGAIN, check "Exclude from display"
4) In the "(Vote results) Vote results: Value (Rating)" field settings, go down to "Rewrite Results" and check "Rewrite the output of this field", then in the text box below, enter the following replacement pattern:
[field_rating]
By doing this, you get the benefit of sorting the column by Vote results: Value (Rating), but show the actual star rating.
Hope this helps,
ruess
Comment #3
ayesh commented#2 works, but did not need excluded fields.
Here is how I did it.
1. Add all fields you want to to display in the view as normal.
2. Add new relationship to Content: Vote results.
3. Choose appropriate settings here. In my case, i wanted to show top rated providers list so I added Percentage, overall as the tag (default tag is "vote". Choose what you want) and average as aggregate method.
4. Add new sort criteria: Vote results: value. For top rated items, choose descending.
Sorry for bumping this issue - just wanted to share a simple way for googlers.
Comment #4
squarecandy commentedThanks all - helpful...
I had to use "percentage" for the sorting value.
"points" didn't do anything.
Comment #5
brandy.brown commentedOK #3 worked awesome for me.