Using this API function:-

$vote_data = votingapi_get_voting_results('node', $node_id);
echo $vote_data[0]->value; // average
echo $vote_data[1]->value; // count

These TWO arrays (keyed, '0' and '1'), switch back and forth indeterminably?!

I think it's a bug, or some kinda issue...

Comments

eaton’s picture

Status: Active » Closed (won't fix)

There's no assurance that the results will come in with a particular order. votingapi_get_results() just tosses back an array of 'vote result records'; there may be multiple averages based on tag, or multiple counts based on tag, in addition to the main one. So it just puts them in an array and allows authors to pick the one they need. It's less than ideal but there are provisions for better filtering in the 6.x branch.