Created
May 24, 2011 21:37
-
-
Save fractastical/989763 to your computer and use it in GitHub Desktop.
@CloudCoder Get Chatter Top Posters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Recommendation> getRecipeEightTopPosters() | |
{ | |
List<AggregateResult> results = [ | |
SELECT ParentId pid, Parent.Name pname, COUNT(id) fcount | |
FROM UserFeed | |
WHERE Type='UserStatus' | |
AND CreatedDate = THIS_WEEK | |
GROUP BY Parent.Name, ParentId | |
ORDER BY Count(id) DESC LIMIT 10]; | |
List<Recommendation> top = new List<Recommendation>(); | |
Recommendation r = null; | |
for (AggregateResult ar : results) | |
{ | |
r = new Recommendation(); | |
r.count = ar.get('fcount') + ''; | |
r.name = ar.get('pname')+''; | |
r.entityid = ar.get('pid')+''; | |
top.add(r); | |
} | |
return top; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment