diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:59 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-09-13 14:50:59 +0100 |
commit | 1e2b6a8acf65f48edb1e03f4f024db9644765897 (patch) | |
tree | d8b87e874e383fcac83e29cf05673606c946fc4e /app/models/request_classification.rb | |
parent | bd94b0390fcfba53bee7d546227e94e860f37c17 (diff) | |
parent | 6d3d9d9846fa905e606f0a2aa6f1ec32122f4850 (diff) |
Merge branch 'wdtk' of git.mysociety.org:/data/git/public/alaveteli into wdtk
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 |