I am using Advanced Poll for the actual voting interface. Not sure if this is an Advanced Poll issue or a Voting API issue.
On the output side, I noticed that no matter what relationship I add ("Content: Votes" or "Comment: Votes"), I don't get any vote data back.
It looks like the interpretation of the entity_type column on the "votingapi_vote" table is inconsistent between the views handlers and the rest of the module. For example, the view handler expects entity_type to be either "node" (for "Content: Votes") or "comment" (for "Comment: Votes"), but it's actually "advpoll" (in this case).
I'm guessing that the column is really representing the content type ("advpoll"), rather than the entity type ("node"). I would expect "entity_type" to mean what Views expects -- that it's the type of Drupal 7 entity. If the content type is also needed, I'd expect to see a separate "bundle" column for holding the content type, to match D7 conventions.
Here's an example query from Views:
SELECT comment.subject AS comment_subject, comment.cid AS cid, comment.nid AS comment_nid, node_comment.title AS node_comment_title, node_comment.nid AS node_comment_nid, comment.name AS comment_name, comment.uid AS comment_uid, comment.homepage AS comment_homepage, votingapi_vote_node.value AS votingapi_vote_node_value, votingapi_vote_node.value_type AS votingapi_vote_node_value_type, votingapi_vote_comment.value AS votingapi_vote_comment_value, votingapi_vote_comment.value_type AS votingapi_vote_comment_value_type, comment.created AS comment_created
FROM
{comment} comment
INNER JOIN {node} node_comment ON comment.nid = node_comment.nid
LEFT JOIN {votingapi_vote} votingapi_vote_node ON node_comment.nid = votingapi_vote_node.entity_id AND votingapi_vote_node.entity_type = 'node'
LEFT JOIN {votingapi_vote} votingapi_vote_comment ON comment.cid = votingapi_vote_comment.entity_id AND votingapi_vote_comment.entity_type = 'comment'
WHERE (( (comment.status <> '0') AND (node_comment.status = '1') ))
ORDER BY comment_created DESC
LIMIT 10 OFFSET 0| Comment | File | Size | Author |
|---|---|---|---|
| #9 | 0001-Use-entity_type-instead-of-node-type-in-votingapi.patch | 8.89 KB | torotil |
Comments
Comment #1
torotil commentedHi, sorry for the late follow-up. Did you upgrade your site from D6 to D7 at some point? My first guess would be that the upgrade-path is broken somehow.
Comment #2
torotil commentedComment #3
Magic03 commentedHave same problem. Looking into this issue I've found :
entity_type is set to type of my voting (Advanced poll) but it should be sent to entity type = 'node'
From API.txt
Could you please fix it.
Comment #4
torotil commented@Magic03 Did you upgrade this module at some point? What was the version that you used before that?
Comment #5
maulwuff commentedI use it on a new site built from scratch. Maybe a look at #1540674: Views Integration may help finding the right module to get this fixed?
Comment #6
Magic03 commented2torotil
using fresh install
Comment #7
torotil commentedThanks - having the bug appear in an from-scratch install should make it easier reproducible and fixable. I guess I'll find some time for that in the next few days.
Comment #8
torotil commentedThe voting-module (in this case advpoll) is responsible for giving the correct entity_type. It seems advpoll still uses the node->type instead of the entity_type and thus is incompatible with recent votingapi versions (since 7.x-2.0).
Comment #9
torotil commentedHere's a patch that makes advpoll work with the current votingapi-7.x-2.x.
I hope I've caught all instances of "entity_type = advpoll". As I don't use advpoll myself this really needs testing!
Comment #10
tripper54 commentedThis is a duplicate of #1528052: AJAX error after voting or cancelling a vote.