Module: Workarea::Reports::GroupByTime

Extended by:
ActiveSupport::Concern
Included in:
AverageOrderValue, FirstTimeVsReturningSales, SalesOverTime, SearchesOverTime, SearchesWithoutResultsOverTime
Defined in:
app/queries/workarea/reports/group_by_time.rb

Instance Method Summary collapse

Instance Method Details

#group_byObject



22
23
24
# File 'app/queries/workarea/reports/group_by_time.rb', line 22

def group_by
  @group_by ||= params[:group_by].presence_in(group_bys) || 'month'
end

#time_group_idObject



11
12
13
14
15
16
17
18
19
20
# File 'app/queries/workarea/reports/group_by_time.rb', line 11

def time_group_id
  case group_by
  when 'year' then year_id
  when 'quarter' then quarter_id
  when 'week' then week_id
  when 'day_of_week' then day_of_week_id
  when 'day' then day_id
  else month_id
  end
end