Skip to content
Snippets Groups Projects
Commit 9901c3df authored by Timothy Andrew's avatar Timothy Andrew
Browse files

Add a JSON version of the `CycleAnalytics` page.

parent f5b9837c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,6 +3,11 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
 
def show
@cycle_analytics = CycleAnalytics.new(@project, from: parse_start_date)
respond_to do |format|
format.html
format.json { render json: @cycle_analytics }
end
end
 
private
Loading
Loading
Loading
Loading
@@ -6,6 +6,13 @@ class CycleAnalytics
@from = from
end
 
def as_json(options = {})
{
issue: issue, plan: plan, code: code, test: test,
review: review, staging: staging, production: production
}
end
def issue
calculate_metric(Queries::issues(@project, created_after: @from),
-> (data_point) { data_point[:issue].created_at },
Loading
Loading
Loading
Loading
@@ -101,6 +101,7 @@ class ProjectPolicy < BasePolicy
can! :admin_pipeline
can! :admin_environment
can! :admin_deployment
can! :read_cycle_analytics
end
 
def public_access!
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment