You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
377 B
20 lines
377 B
3 years ago
|
# frozen_string_literal: true
|
||
|
|
||
|
class REST::Admin::CohortSerializer < ActiveModel::Serializer
|
||
|
attributes :period, :frequency
|
||
|
|
||
|
class CohortDataSerializer < ActiveModel::Serializer
|
||
|
attributes :date, :percent, :value
|
||
|
|
||
|
def date
|
||
|
object.date.iso8601
|
||
|
end
|
||
|
end
|
||
|
|
||
|
has_many :data, serializer: CohortDataSerializer
|
||
|
|
||
|
def period
|
||
|
object.period.iso8601
|
||
|
end
|
||
|
end
|