Fix views sorting of NULL values as 0

douggreen - January 14, 2008 - 15:19
Project:Voting API
Version:6.x-2.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

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.

AttachmentSize
sort.patch2.8 KB

#1

ingo86 - September 4, 2009 - 23:39
Version:5.x-1.x-dev» 6.x-2.3

i 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.

 
 

Drupal is a registered trademark of Dries Buytaert.