Class: Workarea::Insights::Base
- Inherits:
-
Object
- Object
- Workarea::Insights::Base
show all
- Includes:
- ApplicationDocument
- Defined in:
- app/models/workarea/insights/base.rb
Direct Known Subclasses
BestCustomers, BestFullPriceCustomers, ColdProducts, ColdSearches, CustomerAcquisition, CustomersAtRisk, HotProducts, HotSearches, LowAovCustomers, MostDiscountGiven, MostDiscountedProducts, NewProducts, NonSellers, PopularSearches, PopularSearchesWithoutResults, ProductsPurchasedTogether, ProductsToImprove, PromisingProducts, ReleaseReminder, RepeatPurchaseRate, SalesByNavigation, SearchesToImprove, StarProducts, StarSearches, TopCategories, TopDiscounts, TopProducts, TrendingProducts, TrendingSearches, UpcomingReleases
Class Method Summary
collapse
Instance Method Summary
collapse
#releasable?
assert_valid_config!, async, disable, enable, inline, #run_callbacks
#embedded_children
Class Method Details
.beginning_of_last_month ⇒ Object
44
45
46
|
# File 'app/models/workarea/insights/base.rb', line 44
def beginning_of_last_month
Time.current.last_month.beginning_of_month
end
|
.current ⇒ Object
35
36
37
|
# File 'app/models/workarea/insights/base.rb', line 35
def current
desc(:created_at).first || new
end
|
.dashboards ⇒ Object
Allow subclasses to specify on which dashboards they show
40
41
42
|
# File 'app/models/workarea/insights/base.rb', line 40
def dashboards
[]
end
|
.end_of_last_month ⇒ Object
48
49
50
|
# File 'app/models/workarea/insights/base.rb', line 48
def end_of_last_month
Time.current.last_month.end_of_month
end
|
.generate_daily! ⇒ Object
23
24
25
|
# File 'app/models/workarea/insights/base.rb', line 23
def generate_daily!
end
|
.generate_monthly! ⇒ Object
31
32
33
|
# File 'app/models/workarea/insights/base.rb', line 31
def generate_monthly!
end
|
.generate_weekly! ⇒ Object
27
28
29
|
# File 'app/models/workarea/insights/base.rb', line 27
def generate_weekly!
end
|
Instance Method Details
#include?(test) ⇒ Boolean
57
58
59
60
61
62
63
|
# File 'app/models/workarea/insights/base.rb', line 57
def include?(test)
test_typecasted = test.transform_keys(&:to_s).transform_values(&:to_s)
results.any? do |result|
result_typecasted = result.transform_keys(&:to_s).transform_values(&:to_s)
(test_typecasted.to_a - result_typecasted.to_a).empty?
end
end
|
#slug ⇒ Object
53
54
55
|
# File 'app/models/workarea/insights/base.rb', line 53
def slug
self.class.name.demodulize.underscore
end
|