class Totalizer::ChurnMessage

Public Class Methods

new(growth_metric, previous_activity_metric, this_activity_metc, duration) click to toggle source
# File lib/totalizer/message.rb, line 73
def initialize growth_metric, previous_activity_metric, this_activity_metc, duration
  self.duration = duration

  new_and_existing = previous_activity_metric.value + growth_metric.value
  lost_existing = (previous_activity_metric.ids - this_activity_metc.ids).size
  final = new_and_existing - lost_existing
  self.text = "#{period_string}: #{percentage_string lost_existing.to_f / new_and_existing.to_f} (#{lost_existing}/#{new_and_existing})"
  self.description = Totalizer.descriptions.churn
end