Sha256: 555665c35bbec34d8d33c22b83a000748ba5b276a70d184ada0b1916324433d5

Contents?: true

Size: 641 Bytes

Versions: 39

Compression:

Stored size: 641 Bytes

Contents

class Kaui::Analytics

  def self.accounts_over_time
    running_total(Kaui::KillbillHelper.get_accounts_created_over_time)
  end

  def self.subscriptions_over_time(product_type, slug)
    running_total(Kaui::KillbillHelper.get_subscriptions_created_over_time(product_type, slug))
  end

  # The analytics API returns the number of accounts created per day but we want to display a running total
  def self.running_total(per_day)
    total = []
    per_day.values.each_with_index do |value, idx|
      total << value + (idx == 0 ? 0 : total[idx - 1])
    end
    Kaui::TimeSeriesData.new(:dates => per_day.dates, :values => total)
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
kaui-0.6.6 app/models/kaui/analytics.rb
kaui-0.6.5 app/models/kaui/analytics.rb
kaui-0.6.4 app/models/kaui/analytics.rb
kaui-0.6.3 app/models/kaui/analytics.rb
kaui-0.6.2 app/models/kaui/analytics.rb
kaui-0.6.1 app/models/kaui/analytics.rb
kaui-0.6.0 app/models/kaui/analytics.rb
kaui-0.5.3 app/models/kaui/analytics.rb
kaui-0.5.2 app/models/kaui/analytics.rb
kaui-0.5.1 app/models/kaui/analytics.rb
kaui-0.5.0 app/models/kaui/analytics.rb
kaui-0.4.9 app/models/kaui/analytics.rb
kaui-0.4.8 app/models/kaui/analytics.rb
kaui-0.4.7 app/models/kaui/analytics.rb
kaui-0.4.6 app/models/kaui/analytics.rb
kaui-0.4.5 app/models/kaui/analytics.rb
kaui-0.4.4 app/models/kaui/analytics.rb
kaui-0.4.3 app/models/kaui/analytics.rb
kaui-0.4.2 app/models/kaui/analytics.rb
kaui-0.4.1 app/models/kaui/analytics.rb