Add graphs and retention metrics to admin dashboard (#16829)
This commit is contained in:
parent
959f7fc580
commit
07341e7aa6
46 changed files with 1650 additions and 257 deletions
22
app/controllers/api/v1/admin/retention_controller.rb
Normal file
22
app/controllers/api/v1/admin/retention_controller.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Api::V1::Admin::RetentionController < Api::BaseController
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
before_action :require_staff!
|
||||
before_action :set_cohorts
|
||||
|
||||
def create
|
||||
render json: @cohorts, each_serializer: REST::Admin::CohortSerializer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_cohorts
|
||||
@cohorts = Admin::Metrics::Retention.new(
|
||||
params[:start_at],
|
||||
params[:end_at],
|
||||
params[:frequency]
|
||||
).cohorts
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue