Class: SirTracksAlot::Reports::SimpleReport

Inherits:
Report
  • Object
show all
Defined in:
lib/sir_tracks_alot/reports/simple_report.rb

Defined Under Namespace

Modules: Helpers Classes: HTML

Constant Summary collapse

COLUMN_NAMES =
['target', 'page views', 'visits']

Instance Attribute Summary

Attributes inherited from Report

#all

Instance Method Summary collapse

Methods inherited from Report

build_rows

Instance Method Details

#setupObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sir_tracks_alot/reports/simple_report.rb', line 8

def setup      
  options.column_names ||= COLUMN_NAMES
  
  rows = Report.build_rows(options.filters)
  
  table = Table(options.column_names, :data => rows)
  
  if options.group
    grouping = Grouping(table, :by => options.group, :order => options.group)
    grouping.each{|n, g| g.sort_rows_by!('count', :order => :descending)}
    self.data = grouping
  else
    table.sort_rows_by!('page views', :order => :descending)        
    self.data = table
  end

end