summaryrefslogtreecommitdiff
path: root/app/controllers/projects
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/projects')
-rw-r--r--app/controllers/projects/cycle_analytics/events_controller.rb26
-rw-r--r--app/controllers/projects/cycle_analytics_controller.rb4
2 files changed, 15 insertions, 15 deletions
diff --git a/app/controllers/projects/cycle_analytics/events_controller.rb b/app/controllers/projects/cycle_analytics/events_controller.rb
index 5e9524b15db..e571e1dfce2 100644
--- a/app/controllers/projects/cycle_analytics/events_controller.rb
+++ b/app/controllers/projects/cycle_analytics/events_controller.rb
@@ -9,46 +9,46 @@ module Projects
before_action :authorize_read_merge_request!, only: [:code, :review]
def issue
- render_events(events.issue_events)
+ render_events(cycle_analytics.events_for(:issue))
end
def plan
- render_events(events.plan_events)
+ render_events(cycle_analytics.events_for(:plan))
end
def code
- render_events(events.code_events)
+ render_events(cycle_analytics.events_for(:code))
end
def test
- options[:branch] = events_params[:branch_name]
+ options(events_params)[:branch] = events_params[:branch_name]
- render_events(events.test_events)
+ render_events(cycle_analytics.events_for(:test))
end
def review
- render_events(events.review_events)
+ render_events(cycle_analytics.events_for(:review))
end
def staging
- render_events(events.staging_events)
+ render_events(cycle_analytics.events_for(:staging))
end
def production
- render_events(events.production_events)
+ render_events(cycle_analytics.events_for(:production))
end
private
-
- def render_events(events_list)
+
+ def render_events(events)
respond_to do |format|
format.html
- format.json { render json: { events: events_list } }
+ format.json { render json: { events: events } }
end
end
- def events
- @events ||= Gitlab::CycleAnalytics::Events.new(project: project, options: options)
+ def cycle_analytics
+ @cycle_analytics ||= ::CycleAnalytics.new(project, options: options(events_params))
end
def events_params
diff --git a/app/controllers/projects/cycle_analytics_controller.rb b/app/controllers/projects/cycle_analytics_controller.rb
index 93dbe2819e7..cf53d0a1919 100644
--- a/app/controllers/projects/cycle_analytics_controller.rb
+++ b/app/controllers/projects/cycle_analytics_controller.rb
@@ -6,7 +6,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
before_action :authorize_read_cycle_analytics!
def show
- @cycle_analytics = ::CycleAnalytics.new(@project, options: options)
+ @cycle_analytics = ::CycleAnalytics.new(@project, options: options(cycle_analytics_params))
@cycle_analytics_no_data = @cycle_analytics.no_stats?
@@ -21,7 +21,7 @@ class Projects::CycleAnalyticsController < Projects::ApplicationController
def cycle_analytics_params
return {} unless params[:cycle_analytics].present?
- { start_date: params[:cycle_analytics][:start_date] }
+ params[:cycle_analytics].slice(:start_date)
end
def cycle_analytics_json