Class: SirTracksAlot::Reports::ActivityReport

Inherits:
SirTracksAlotReport show all
Defined in:
lib/sir_tracks_alot/reports/activity_report.rb

Defined Under Namespace

Modules: Helpers Classes: HTML

Constant Summary collapse

COLUMN_NAMES =
['actor', 'action', 'target', 'event']
LIMIT =
10000

Instance Attribute Summary

Attributes inherited from SirTracksAlotReport

#all

Attributes inherited from Report

#all

Instance Method Summary collapse

Methods inherited from Report

build_rows

Instance Method Details

#setupObject


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/sir_tracks_alot/reports/activity_report.rb', line 10

def setup
  super    
  options.column_names ||= COLUMN_NAMES
  
  activities = Activity.recent({:owner => options.owner}, :order => 'DESC', :limit => (options.limit || LIMIT))
  events = activities.collect{|a| [a.actor, a.action, a.target, a.last_event]}.reject{|a| a[2].nil?}
  
  table = Table(options.column_names, :data => events)
  table.sort_rows_by!('event', :order => :descending)
  
  self.data = table
end