Class: Workarea::Admin::Insights::DiscountViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Includes:
InsightsDetails
Defined in:
app/view_models/workarea/admin/insights/discount_view_model.rb

Instance Method Summary collapse

Methods included from InsightsDetails

#current_period, #ends_at, #previous_ends_at, #previous_period, #previous_starts_at, #starts_at

Instance Method Details

#feedObject



13
14
15
16
17
# File 'app/view_models/workarea/admin/insights/discount_view_model.rb', line 13

def feed
  @feed ||= InsightViewModel.wrap(
    Workarea::Insights::Base.by_discount(model.id).to_a
  )
end

#top?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'app/view_models/workarea/admin/insights/discount_view_model.rb', line 19

def top?
  Workarea::Insights::TopDiscounts.current.include?(discount_id: model.id)
end