When using votingapi values with views sorts, NULL values are placed at the bottom of the sort, but should rather be treated as 0 values. There are two possible solutions: (a) store zero value counts in the database (see #141439) or (b) query NULL's as 0's.
The attached patch implements the second option (b). This only changes the query used to create the views sort column. It doesn't change votingapi data storage or the calculation of values. I hope that by changing only the views sort query, that this patch will have more merit than one that changes the data structures and calculations, that would be necessary for option (a).
I've only tested it with the vote/points/sum combination, but hopefully it will work for others.
| Comment | File | Size | Author |
|---|---|---|---|
| sort.patch | 2.8 KB | douggreen |
Comments
Comment #1
ingo86 commentedi have the same problem, trying with views to sort nodes by votes (using sum as relationship) I always get -1 or +1 before 0.
I'm using 6.x 2.3 version.
This probably should be marked as critical, as a feature is not working fine.
Comment #2
JamieR commentedSubscribing. I'm having the same issue.
Comment #3
crea commentedSubs
Comment #4
chuckbar77 commentedIs this still an issue? Thank you
Comment #5
eaton commentedThe latest version of VotingAPI for D6 and D7 allow admins to set up Views that use zero as a replacement for null values when sorting and filtering.