summaryrefslogtreecommitdiff
path: root/app/serializers/cohort_entity.rb
blob: 3d0213e1038f096d1edce8405836a64fec83ab22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

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