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

sudeoo’s picture

try 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']);
}

westbywest’s picture

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

eaton’s picture

Status: Active » Closed (won't fix)

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