2021-10-15 05:44:59 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::Admin::CohortSerializer < ActiveModel::Serializer
|
|
|
|
attributes :period, :frequency
|
|
|
|
|
|
|
|
class CohortDataSerializer < ActiveModel::Serializer
|
2022-01-24 02:01:25 +11:00
|
|
|
attributes :date, :rate, :value
|
2021-10-15 05:44:59 +11:00
|
|
|
|
|
|
|
def date
|
|
|
|
object.date.iso8601
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
has_many :data, serializer: CohortDataSerializer
|
|
|
|
|
|
|
|
def period
|
|
|
|
object.period.iso8601
|
|
|
|
end
|
|
|
|
end
|