I can only get a view to sort total votes and not the average from going from positive to negative. Anyone know how to do this?
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | comments_sort_desc_with_vote_up_down.txt | 8.18 KB | elvis2 |
I can only get a view to sort total votes and not the average from going from positive to negative. Anyone know how to do this?
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | comments_sort_desc_with_vote_up_down.txt | 8.18 KB | elvis2 |
Comments
Comment #1
totaldrupal commentedGot it to work but doesn't make sense. Had to sort the view based on the field (title, picture etc.) not by votes. I don't know why but it works.
Could not get the view to show vote total though, only a -1 or 1.
Comment #2
totaldrupal commentedlost again. cloned the view, changed the node type and again it does not sort right.
Comment #3
CarbonPig commentedSubscribe - Any progress? - can't get views to sort by vote total
Comment #4
Starvin15 commentedSubscribe - I am at a loss. I've been playing around with this for a couple of days any the only thing I can conclude is that views will not sort unless it is in a field format as opposed to node format. I can get the vote up/down to sort by value if I have the view formatted as a field, but as soon as I switch to node, no dice.
Has anyone had any luck sorting nodes through views? If so what settings are you using? Is it possible to create a view block displaying nodes (not fields) with vote up/down enabled on it, and have it sort? This is a similar questions, but it seems vote up/down is treated differently as a block.
***Apologies, I switched to version 2.0 dev of voting API and this issue is fixed. If anyone is still having this problem with this version subscribe and I can post my views setting to get the ranking to work.
Comment #5
Flying Drupalist commentedThis is a votingapi issue, and it's fixed. :)
Comment #7
AntiNSA commentedCan you tell me how it is fixed?
Comment #8
robobeau commentedHey, guys. I'm posting to let you guys know how I solved my issue.
My problem was I'm making a playlist site, and the playlist sorts by vote percentage. Of course, songs that have not been voted on = NULL, so the sorting returns +1, -1, then 0. For a playlist, it would make sense that songs that have not been voted on are treated as "indifferent", so -1 should fall below these.
They way I solved this was by (gasp!) adding a function to the module. Technically, you should make a separate module for this, but c'mon...
I posted this on the very bottom of vote_up_down.views.inc. I hope it's somehow useful to other people on this forum:
Comment #9
marvil07 commentedrobobeau: I think you only want to check the checkbox "Require this relationship" on the relationship configuration "Node: Votes" to TRUE ;-)
Comment #10
elvis2 commentedHere is the fix:
First, update to most recent releases of ctools, views, votingapi and vote_up_down
Make sure there are no database updates (visit update.php)
I am working with comments, so in my view I have the following
Relationships
==========
Add > Comment: Vote Results
Group Type: sum
Require Relations: NOT checked
Data Filters: All set to no filtering
Sort Criteria
===========
Add > Vote Results: Value
Group Type: sum
Relationship: Vote Results
Sort: Desc
Attached is an export to play with.