Closed (won't fix)
Project:
Voting API
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 May 2007 at 23:43 UTC
Updated:
24 Jun 2009 at 15:54 UTC
I am trying to set up a view that provides nodes of a particular type that do NOT have any votes. I would have thought that a filter for VotingAPI percent rating value > 0 would do it, but it does not. I can filter nodes which DO have a rating (using the NodeAPI Average Vote >= 1 setting), but I haven't figured out how to do the complement (NodeAPI Average Vote < 1 doesn't do it!). Can you help? Thanks!
Comments
Comment #1
sudeoo commentedtry the following code in votingapi_views.inc in votingapi module.
replacing (line 212):
$query->add_where("%s %s %d", $field, $filter['operator'], $filter['value']);
with:
if (( $filter['operator'] == "<") || ( $filter['operator'] == "<=") ){
$query->add_where("$field is NULL OR %s %s %d", $field, $filter['operator'], $filter['value']);
} else {
$query->add_where("%s %s %d", $field, $filter['operator'], $filter['value']);
}
Comment #2
westbywest commentedIs this patch likely to find its way into the released code? I had to use it so that I could create a view that includes nodes with NO VOTES (i.e. just submitted, not voted on yet) and nodes with votes below an arbitrary threshold.
Comment #3
eaton commentedViews integration in VotingAPI 5.x is fundamentally broken -- it works for a small number of cases but more complex cases like this are not supported, and this isn't being developed further. Views support was rewriten in the 2.x branch to fix these issues. If anyone wants to take a stab at rewriting the Views integration for D5, they're welcome to, but it's not on my radar at present.