Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.5
Component:
Views Data
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2012 at 21:36 UTC
Updated:
22 Aug 2013 at 05:29 UTC
Jump to comment: Most recent file
Comments
Comment #1
grn commentedI managed to create a semi wanted user list shown in the attached screen shot. At first I only need to count the aggregate votes on comments the user has created.
Here are the settings:
It is a comment view, table view with grouping by Author.
Fields
Comment: Author (Author) | Aggregation settings
(Votes) SUM(Votes: Value) (Value) | Aggregation settings
Relationships
Comment: Content
Comment: Votes
Use aggregation: Yes
I hoped the aggregation settings would sum up to a single testuser1, but I get two records (one per comment). How could we aggregate this, so it becomes: testuser1, 3 instead?

Any thoughts are always great :-)
Thanks.
/GrN.dk
Comment #2
grn commentedBonusinfo.
I have also been tinkering around with some queries:
The result is similar to the view output, where we have 3 votes for comments created by testuser 1 and 1 vote on comments created by Innovator:
testuser1
testuser1
testuser1
Innovator
The PHP:
<?php
$query = db_select('votingapi_vote', 'v');
$query->join('comment', 'c', 'c.cid = v.entity_id'); //AND entity_type == comment needs to be added.
$result = $query
->fields('c', array('name'))
->execute();
foreach ($result as $row)
{
foreach ($row as $entity_id => $entity) {
print $entity."
";
}
}
This stuff is quite new for me, so any enhancements are welcome :-)
/GrN.dk
Comment #3
grn commentedWell.
I found the solution. You just need to keep your views straight :-)
The exported view is attached.
/GrN.dk
Comment #4
grn commentedIn addition to the total votes. Is it possible to have an additional field with votes created for example the past 24 hours? Or votes posted on comments on the latest node-content?
Will we need some sort of consolidation of fields from different views?
Any thoughts are appreciated.
Thanks.
/GrN.dk
Comment #5
grn commentedI guess there are a lot of discussions about union views, so I will close this one (for example http://drupal.stackexchange.com/questions/31786/how-to-create-a-union-of...) . Fell free to open it if you have any hints, thoughts, or you are interested in hearing the latest dev news from me.
Thanks.
/GrN.dk
Comment #6
ace11 commentedHow to get total points of user who authored node which were voted?