diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:10 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:10 +0100 |
commit | 77fdd7cd39bd6166932eb5286b251de79de0a57d (patch) | |
tree | f63e86efd270a5872b0a81e3495e3e63bbaa8c8f /app/models/request_classification.rb | |
parent | 0bf0be30cfbb866727a98ae22444aa0a724288b1 (diff) | |
parent | a622b31a33658696525ad675cdeb1e433f2a7c8b (diff) |
Merge branch 'develop' of git.mysociety.org:/data/git/public/alaveteli into develop
Diffstat (limited to 'app/models/request_classification.rb')
-rw-r--r-- | app/models/request_classification.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/models/request_classification.rb b/app/models/request_classification.rb new file mode 100644 index 000000000..678b6cd16 --- /dev/null +++ b/app/models/request_classification.rb @@ -0,0 +1,16 @@ +class RequestClassification < ActiveRecord::Base + belongs_to :user + + # return classification instances representing the top n + # users, with a 'cnt' attribute representing the number + # of classifications the user has made. + def RequestClassification.league_table(size, conditions=[]) + find(:all, :select => 'user_id, count(*) as cnt', + :conditions => conditions, + :group => 'user_id', + :order => 'cnt desc', + :limit => size, + :include => :user) + end + +end
\ No newline at end of file |