Class: Workarea::Admin::Reports::SalesByTrafficReferrerViewModel

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

Instance Method Summary collapse

Instance Method Details

#resultsObject



5
6
7
8
9
10
11
12
13
14
# File 'app/view_models/workarea/admin/reports/sales_by_traffic_referrer_view_model.rb', line 5

def results
  @results ||= model.results.map do |result|
    processed = {
      medium: result['_id']['medium']&.titleize,
      source: result['_id']['source']&.titleize
    }.merge(result)

    OpenStruct.new(processed)
  end
end