Sha256: 9b29bd4007539215dc5ecb4962217c3a51dd965e91808b760b06f1623cd08bfc
Contents?: true
Size: 1001 Bytes
Versions: 34
Compression:
Stored size: 1001 Bytes
Contents
module Workarea class GenerateInsights include Sidekiq::Worker delegate :perform, to: :class class << self def generate_all! generate_daily_insights generate_weekly_insights generate_monthly_insights end def perform(*) generate_daily_insights generate_weekly_insights if Time.current.monday? generate_monthly_insights if Time.current.day == 1 end def generate_daily_insights Insights::Base.subclasses.each(&:generate_daily!) end def generate_weekly_insights Metrics::ProductForLastWeek.aggregate! Metrics::ProductByWeek.append_last_week! Metrics::SearchForLastWeek.aggregate! Metrics::SearchByWeek.append_last_week! Metrics::User.update_aggregations! Insights::Base.subclasses.each(&:generate_weekly!) end def generate_monthly_insights Insights::Base.subclasses.each(&:generate_monthly!) end end end end
Version data entries
34 entries across 34 versions & 1 rubygems