class Blackbeard::Cohort

Public Instance Methods

add(context, timestamp = nil, force = false) click to toggle source
# File lib/blackbeard/cohort.rb, line 11
def add(context, timestamp = nil, force = false)
  save if new_record?
  uid = context.unique_identifier
  #TODO: Make sure timestamp is in correct tz
  timestamp ||= tz.now
  return (force) ? data.add_with_force(uid, timestamp) : data.add_without_force(uid, timestamp)
end
chartable_result_for_day(date) click to toggle source
# File lib/blackbeard/cohort.rb, line 43
def chartable_result_for_day(date)
  {'participants' => data.participants_for_day(date) }
end
chartable_result_for_hour(hour) click to toggle source
# File lib/blackbeard/cohort.rb, line 39
def chartable_result_for_hour(hour)
  {'participants' => data.participants_for_hour(hour) }
end
chartable_segments() click to toggle source
# File lib/blackbeard/cohort.rb, line 35
def chartable_segments
  ['participants']
end
data() click to toggle source
# File lib/blackbeard/cohort.rb, line 19
def data
  @data ||= CohortData.new(self)
end
hour_id_for_participant(uid) click to toggle source
# File lib/blackbeard/cohort.rb, line 31
def hour_id_for_participant(uid)
  data.hour_id_for_participant(uid)
end
metric_data(metric) click to toggle source
# File lib/blackbeard/cohort.rb, line 27
def metric_data(metric)
  CohortMetric.new(self,metric).metric_data
end
name() click to toggle source
# File lib/blackbeard/cohort.rb, line 23
def name
  storable_attributes_hash['name'] || id
end