0
0
Fork 0

Add graphs and retention metrics to admin dashboard (#16829)

This commit is contained in:
Eugen Rochko 2021-10-14 20:44:59 +02:00 committed by GitHub
parent 959f7fc580
commit 07341e7aa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 1650 additions and 257 deletions

View file

@ -0,0 +1,19 @@
# 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

View file

@ -0,0 +1,5 @@
# frozen_string_literal: true
class REST::Admin::DimensionSerializer < ActiveModel::Serializer
attributes :key, :data
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
class REST::Admin::MeasureSerializer < ActiveModel::Serializer
attributes :key, :total, :previous_total, :data
def total
object.total.to_s
end
def previous_total
object.previous_total.to_s
end
end

View file

@ -0,0 +1,13 @@
# frozen_string_literal: true
class REST::Admin::TagSerializer < REST::TagSerializer
attributes :id, :trendable, :usable, :requires_review
def id
object.id.to_s
end
def requires_review
object.requires_review?
end
end