Class: Workarea::Admin::Dashboards::PeopleViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Includes:
InsightsGraphs
Defined in:
app/view_models/workarea/admin/dashboards/people_view_model.rb

Instance Method Summary collapse

Methods included from InsightsGraphs

#ends_at, #previous_ends_at, #previous_starts_at, #starts_at

Instance Method Details

#insightsObject



31
32
33
34
35
# File 'app/view_models/workarea/admin/dashboards/people_view_model.rb', line 31

def insights
  @insights ||= InsightViewModel.wrap(
    Workarea::Insights::Base.by_dashboard('people').page(options[:page])
  )
end

#new_vs_returning_line_graph_dataObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/view_models/workarea/admin/dashboards/people_view_model.rb', line 11

def new_vs_returning_line_graph_data
  [
    {
      name: t('workarea.admin.dashboards.people.new'),
      data: first_time_orders_graph_data
    },
    {
      name: t('workarea.admin.dashboards.people.returning'),
      data: returning_orders_graph_data
    }
  ]
end

#new_vs_returning_pie_graph_dataObject



24
25
26
27
28
29
# File 'app/view_models/workarea/admin/dashboards/people_view_model.rb', line 24

def new_vs_returning_pie_graph_data
  {
    t('workarea.admin.dashboards.people.new') => first_time_orders,
    t('workarea.admin.dashboards.people.returning') => returning_orders
  }
end