Closed (fixed)
Project:
Advanced Poll
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Apr 2012 at 11:15 UTC
Updated:
1 Sep 2018 at 06:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
perisdr commentedAfter playing around a lot I found a workaround for making advpoll work with views. I added some code in voting api to achieve this, so hopefully this can be implemented with a hook. Here 's how I created a table with the time my users voted along with their ip address.
Add this code in sites\all\modules\votingapi\views\votingapi.views.inc
If you know a better workaround please share.
Comment #2
Michele Wickham commentedI'll go ahead and mark this as a feature request and see what I can come up with over the week. It should be pretty simple to implement your solution.
Comment #3
perisdr commentedIt may be pretty simple but not sure if it is correct. The problem for sure is that Voting API looks for votes with entity_type either saved as "node" or "comment". Advanced Poll saves the votes with entity_type "advpoll". In the previous issues the developer states two ways to resolve this. Tried to follow his way of thinking but not sure if my way has taken in mind all the possible scenarios (e.g in my way you cannot add data filters like points,percent,normal) Don't know if those were working in the 6.x version though.
Comment #4
Michele Wickham commentedCould you check the latest version of the 7.x-3.x build and see if the way I integrated hook_views_data_alter correctly added your desired fix? If I'm not mistaken, you may need to do a full cache clear to get the view api call to kick in.
If this doesn't work, is it possible for you to export the view and send me a copy of it so that I can see how you're trying to build it?
Thanks!
Comment #5
perisdr commentedCouldn't make it work.
I only have one advpoll node.
Created a view with relationship "Content: Votes (Votes cast by users on nodes.)".
Added fields
I can see the query to the database is not correct.
So the hook to add another enity type 'advpoll' didn't work. Same problem for the "Content: Vote results (Aggregate results of votes cast on nodes.)" relationship. Only in this relationship the query is done to the votinapi_cache table and the entity type is still set to 'node' instead of 'advpoll'.
I am attaching the export of the view. Don't know if you can find something useful there to help you fix the problem.
Comment #6
Michele Wickham commentedThanks - I'll get on this over the weekend - sorry for the delay.
Comment #7
catya commentedDid this fix get added? I'm not seeing it.
Comment #8
drclaw commentedThe problem, I'm finding with the fix that was added in http://drupal.org/node/1540674#comment-5896192 is that it overrides the default relationships provided by the voting api entirely. It makes it impossible to relate votes back to the node table. I'm not sure what the correct solution is, but I've attached a patch as a first attempt. I haven't had the chance to test it fully yet, however. I only noticed this issue because I needed the old votingapi relationships back. If someone could test it that would be great.
Thanks!
Comment #9
skylord commentedCurrent code in advpoll.views.inc has no sense - this file can be deleted at all... Try this patch (basically the same as in #553350: Views Relationship / VotingAPI integration seems incorrect due to content_type but withour formatter - choices labels can be gathered with i.e. "Views PHP" from the same query without additional ones) - with it advpoll integrates with views like a charm for me:
Comment #10
Anonymous (not verified) commentedMade a patch file so we can download it more easily in our projects .make file.
Comment #11
Anonymous (not verified) commentedStatus update.
Comment #12
lukusHey - I've hit this issue. Wondering if others in the thread ever came to a satisfactory conclusion.
Thanks
L
Comment #13
adamazou commentedThanks Perisd, solution #1 worked for me. I tried everything from patching to using Voting Rules and etc..
FYI: I'm using
Drupal 7.32
Advanced Poll : 7.x-3.x-dev
Views : 7.x-3.8
Voting API : 7.x-2.12
Comment #14
joseph.olstadpatch 10 needed a reroll
Comment #15
Road Kill commentedHas anybody been able to produce any poll results in views? I just don't see the Content: Votes relationship with advanced poll.
Comment #16
mikhailkrainiuk commentedComment #18
mikhailkrainiuk commentedOk. The patch committed.