Sha256: 5d5e8a72cd259699e21d5b5d8a83eb85bd7a725921bdba9df2070bd154b29461

Contents?: true

Size: 838 Bytes

Versions: 5

Compression:

Stored size: 838 Bytes

Contents

include ReportCat::Core
include ReportCat::Reports

class UserReport < DateRangeReport

  def initialize
    super(
        :name => :user_report,
        :joins => ReportCat::DateRange.join_to( :users, :created_at )
    )

    add_column( :extra, :integer, :sql => 'null', :hidden => true )
    add_column( :total, :integer, :sql => 'count( users.id )' )
    add_column( :total_ma_2, :moving_average, :target => :total, :interval => 2 )
    add_column( :activated, :integer, :sql => 'sum( users.activated == "t" )' )
    add_column( :activated_to_total, :ratio, :numerator => :activated, :denominator => :total )

    add_chart( :pie_test, :pie, :start_date, [ :total, :activated ] )
    add_chart( :bar_test, :bar, :start_date, [ :total, :activated ] )
    add_chart( :line_test, :line, :start_date, [ :total, :activated ] )
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
report_cat-5.0.3 spec/dummy/app/reports/user_report.rb
report_cat-5.0.2 spec/dummy/app/reports/user_report.rb
report_cat-5.0.1 spec/dummy/app/reports/user_report.rb
report_cat-5.0.0 spec/dummy/app/reports/user_report.rb
report_cat-0.2.0 spec/dummy/app/reports/user_report.rb