Class: SirTracksAlot::Reports::BasicReport

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

Defined Under Namespace

Modules: Helpers Classes: HTML

Constant Summary collapse

COLUMN_NAMES =
['group', 'title', 'count']

Instance Attribute Summary

Attributes inherited from Report

#all

Instance Method Summary collapse

Methods inherited from Report

build_rows

Instance Method Details

#setupObject



7
8
9
10
11
12
13
14
15
# File 'lib/sir_tracks_alot/reports/basic_report.rb', line 7

def setup      
  options.column_names ||= COLUMN_NAMES          
  
  table = Table(options.column_names, :data => options.data)
  grouping = Grouping(table, :by => "group", :order => 'group')
  grouping.each{|n, g| g.sort_rows_by!('count', :order => :descending)}

  self.data = grouping
end