Class: LittleBrother::Statistics
- Inherits:
-
Object
- Object
- LittleBrother::Statistics
- Defined in:
- lib/little_brother/statistics.rb
Constant Summary collapse
- RECORD_LIMIT =
10
Class Method Summary collapse
- .least_active_users(limit = RECORD_LIMIT) ⇒ Object
- .least_active_users_this_month(limit = RECORD_LIMIT) ⇒ Object
- .least_used_action(limit = RECORD_LIMIT) ⇒ Object
- .least_used_controller_action(limit = RECORD_LIMIT) ⇒ Object
-
.most_active_users(limit = RECORD_LIMIT) ⇒ Object
User Statistics.
- .most_active_users_this_month(limit = RECORD_LIMIT) ⇒ Object
-
.most_used_action(limit = RECORD_LIMIT) ⇒ Object
Action Statistics.
-
.most_used_controller_action(limit = RECORD_LIMIT) ⇒ Object
Controller Action Statistics.
Class Method Details
.least_active_users(limit = RECORD_LIMIT) ⇒ Object
11 12 13 |
# File 'lib/little_brother/statistics.rb', line 11 def self.least_active_users limit=RECORD_LIMIT Watcher.count(:all, :conditions => ['user IS NOT NULL'], :group => 'user', :order => "count_all asc", :limit => limit) end |
.least_active_users_this_month(limit = RECORD_LIMIT) ⇒ Object
19 20 21 |
# File 'lib/little_brother/statistics.rb', line 19 def self.least_active_users_this_month limit=RECORD_LIMIT Watcher.count(:all, :conditions => ["user IS NOT NULL and created_at BETWEEN ? AND ?", Time.now.beginning_of_month, Time.now.end_of_month], :group => 'user', :order => "count_all asc", :limit => limit) end |
.least_used_action(limit = RECORD_LIMIT) ⇒ Object
28 29 30 |
# File 'lib/little_brother/statistics.rb', line 28 def self.least_used_action limit=RECORD_LIMIT Watcher.count(:all, :group => 'action', :order => "count_all asc", :limit => limit) end |
.least_used_controller_action(limit = RECORD_LIMIT) ⇒ Object
37 38 39 |
# File 'lib/little_brother/statistics.rb', line 37 def self.least_used_controller_action limit=RECORD_LIMIT Watcher.count(:all, :group => 'controller_action', :order => "count_all asc", :limit => limit) end |
.most_active_users(limit = RECORD_LIMIT) ⇒ Object
User Statistics
7 8 9 |
# File 'lib/little_brother/statistics.rb', line 7 def self.most_active_users limit=RECORD_LIMIT Watcher.count(:all, :conditions => ['user IS NOT NULL'], :group => 'user', :order => "count_all desc", :limit => limit) end |
.most_active_users_this_month(limit = RECORD_LIMIT) ⇒ Object
15 16 17 |
# File 'lib/little_brother/statistics.rb', line 15 def self.most_active_users_this_month limit=RECORD_LIMIT Watcher.count(:all, :conditions => ["user IS NOT NULL and created_at BETWEEN ? AND ?", Time.now.beginning_of_month, Time.now.end_of_month], :group => 'user', :order => "count_all desc", :limit => limit) end |
.most_used_action(limit = RECORD_LIMIT) ⇒ Object
Action Statistics
24 25 26 |
# File 'lib/little_brother/statistics.rb', line 24 def self.most_used_action limit=RECORD_LIMIT Watcher.count(:all, :group => 'action', :order => "count_all desc", :limit => limit) end |
.most_used_controller_action(limit = RECORD_LIMIT) ⇒ Object
Controller Action Statistics
33 34 35 |
# File 'lib/little_brother/statistics.rb', line 33 def self.most_used_controller_action limit=RECORD_LIMIT Watcher.count(:all, :group => 'controller_action', :order => "count_all desc", :limit => limit) end |