2018-07-19 14:43:13 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-06 08:12:12 -04:00
|
|
|
class CohortEntity < Grape::Entity
|
|
|
|
include ActionView::Helpers::NumberHelper
|
|
|
|
|
|
|
|
expose :registration_month do |cohort|
|
|
|
|
cohort[:registration_month].strftime('%b %Y')
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :total do |cohort|
|
|
|
|
number_with_delimiter(cohort[:total])
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :inactive do |cohort|
|
|
|
|
number_with_delimiter(cohort[:inactive])
|
|
|
|
end
|
|
|
|
|
|
|
|
expose :activity_months, using: CohortActivityMonthEntity
|
|
|
|
end
|