Posted by ruccola on September 9, 2010 at 1:32pm
Hi everyone,
I'm having an issue with my view for showing the highest user-rated nodes. NOTE: I'm not using Fivestar, I'm using my own module. My module seem to store everything correctly via VotingAPI, as seen on this look at the votingapi_vote table in the database:
| vote_id | content_type | content_id | value | value_type | tag | uid | timestamp | vote_source |
| 11 | review | 23 | 8 | percent | vote | 1 | 1283949794 | 127.0.0.1 |
| 16 | review | 13 | 5 | percent | vote | 1 | 1283961462 | 127.0.0.1 |
The thing is, I create my view and add a relationship to VotingAPI (Vote: Results -> require this relationship -> filter on "percent", "vote", "average") and the result is empty!
SELECT node.nid AS nid,
node_data_field_artist.field_artist_value AS node_data_field_artist_field_artist_value,
node.type AS node_type,
node.vid AS node_vid,
node.title AS node_title
FROM node node
INNER JOIN votingapi_cache votingapi_cache_node_percent_vote_average ON node.nid = votingapi_cache_node_percent_vote_average.content_id AND (votingapi_cache_node_percent_vote_average.content_type = 'node' AND votingapi_cache_node_percent_vote_average.value_type = 'percent' AND votingapi_cache_node_percent_vote_average.tag = 'vote' AND votingapi_cache_node_percent_vote_average.function = 'average')
LEFT JOIN content_type_review node_data_field_artist ON node.vid = node_data_field_artist.vid
WHERE (node.status <> 0) AND (node.type in ('review'))I need some hints on what could be wrong!
Thanks :)
Comments
Anyone?
Anyone?
pretty please? :)
pretty please? :)
I suspect that your module is
I suspect that your module is not updating the votingapi_cache table. Views tries to get the information from the cache table and if you are writing directly to the votingapi_vote table, then it's likely that the cache is not up to date. There's probably a function you can call to regenerate the cache for the specific node every time someone votes.