Class: Workarea::Insights::MostWishListedProducts
- Inherits:
-
Base
- Object
- Base
- Workarea::Insights::MostWishListedProducts
- Defined in:
- app/models/workarea/insights/most_wish_listed_products.rb
Class Method Summary collapse
Class Method Details
.dashboards ⇒ Object
5 6 7 |
# File 'app/models/workarea/insights/most_wish_listed_products.rb', line 5 def dashboards %w(catalog) end |
.generate_monthly! ⇒ Object
9 10 11 12 |
# File 'app/models/workarea/insights/most_wish_listed_products.rb', line 9 def generate_monthly! results = generate_results create!(results: results) if results.present? end |
.generate_results ⇒ Object
14 15 16 17 18 19 |
# File 'app/models/workarea/insights/most_wish_listed_products.rb', line 14 def generate_results report .results .take(Workarea.config.insights_products_list_max_results) .map { |result| result.merge(product_id: result['_id']) } end |
.report ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'app/models/workarea/insights/most_wish_listed_products.rb', line 21 def report Reports::WishListProducts.new( starts_at: beginning_of_last_month, ends_at: end_of_last_month, sort_by: 'adds', sort_direction: 'desc' ) end |