This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2021-10-14 11:44:59 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class REST::Admin::CohortSerializer < ActiveModel::Serializer
|
|
|
|
attributes :period, :frequency
|
|
|
|
|
|
|
|
class CohortDataSerializer < ActiveModel::Serializer
|
2022-01-23 07:01:25 -08:00
|
|
|
attributes :date, :rate, :value
|
2021-10-14 11:44:59 -07:00
|
|
|
|
|
|
|
def date
|
|
|
|
object.date.iso8601
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
has_many :data, serializer: CohortDataSerializer
|
|
|
|
|
|
|
|
def period
|
|
|
|
object.period.iso8601
|
|
|
|
end
|
|
|
|
end
|