Module: CycleAnalyticsParams

Extended by:
ActiveSupport::Concern
Included in:
Projects::Analytics::CycleAnalytics::SummaryController, Projects::CycleAnalytics::EventsController, Projects::CycleAnalyticsController
Defined in:
app/controllers/concerns/cycle_analytics_params.rb

Instance Method Summary collapse

Instance Method Details

#cycle_analytics_group_paramsObject



12
13
14
15
16
# File 'app/controllers/concerns/cycle_analytics_params.rb', line 12

def cycle_analytics_group_params
  return {} unless params.present?

  params.permit(:group_id, :start_date, :created_after, :created_before, project_ids: [])
end

#cycle_analytics_project_paramsObject



6
7
8
9
10
# File 'app/controllers/concerns/cycle_analytics_params.rb', line 6

def cycle_analytics_project_params
  return {} unless params[:cycle_analytics].present?

  params[:cycle_analytics].permit(:start_date, :created_after, :created_before, :branch_name)
end

#options(params) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/concerns/cycle_analytics_params.rb', line 18

def options(params)
  @options ||= {}.tap do |opts|
    opts[:current_user] = current_user
    opts[:projects] = params[:project_ids] if params[:project_ids]
    opts[:from] = params[:from] || start_date(params)
    opts[:to] = params[:to] if params[:to]
    opts[:end_event_filter] = params[:end_event_filter] if params[:end_event_filter]
    if params[:use_aggregated_data_collector]
      opts[:use_aggregated_data_collector] = params[:use_aggregated_data_collector]
    end

    opts.merge!(params.slice(*::Gitlab::Analytics::CycleAnalytics::RequestParams::FINDER_PARAM_NAMES))
    opts.merge!(date_range(params))
  end
end