Sha256: 31ee727433314f91f7e316e84ee10628b60340e67b837269ba038fae0c7e926d

Contents?: true

Size: 742 Bytes

Versions: 5

Compression:

Stored size: 742 Bytes

Contents

include ReportCat::Core
include ReportCat::Reports

class RetentionReport < DateRangeReport

  def initialize
    super(
        :name => :retention_report,
        :joins => [
            ReportCat::DateRange.join_to( :visits, :created_at ),
            'join users on users.id = visits.user_id'
        ].join( ' ' )
    )

    add_param( :activated, :check_box )

    add_column( :total, :integer, :sql => 'count( distinct visits.user_id )' )
    add_chart( :retention_line, :line, :start_date, :total )
  end

  def where
    sql = super

    sql += " and users.created_at between '#{first_period.start_date}' and '#{first_period.stop_date}'"
    sql += " and users.activated = 't'" if param( :activated ).value

    return sql
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

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