Class: Workarea::Admin::Reports::SalesOverTimeViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Includes:
GroupByTime
Defined in:
app/view_models/workarea/admin/reports/sales_over_time_view_model.rb

Instance Method Summary collapse

Methods included from GroupByTime

#day_of_week?, #get_period_for, #group_by_options, #results, #uneven_day_distribution?

Instance Method Details

#graph_dataObject



7
8
9
10
# File 'app/view_models/workarea/admin/reports/sales_over_time_view_model.rb', line 7

def graph_data
  return [] if day_of_week?
  results.group_by(&:starts_at).transform_values { |v| (v || []).map(&:revenue) }
end