Class: Workarea::Admin::Insights::SearchViewModel

Inherits:
ApplicationViewModel
  • Object
show all
Includes:
InsightsDetails
Defined in:
app/view_models/workarea/admin/insights/search_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/search_view_model.rb', line 13

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

#top?Boolean

Returns:

  • (Boolean)


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

def top?
  Workarea::Insights::PopularSearches.current.include?(_id: model.id)
end

#trending?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/view_models/workarea/admin/insights/search_view_model.rb', line 23

def trending?
  Workarea::Insights::TrendingSearches.current.include?(query_id: model.id)
end