2022-08-29 17:34:09 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# This will generate statistics indicators. Those will be saved in the ElasticSearch database
|
|
|
|
class Statistics::BuilderService
|
|
|
|
class << self
|
|
|
|
def generate_statistic(options = default_options)
|
|
|
|
# remove data exists
|
|
|
|
Statistics::CleanerService.clean_stat(options)
|
|
|
|
|
|
|
|
Statistics::Builders::SubscriptionsBuilderService.build(options)
|
|
|
|
Statistics::Builders::ReservationsBuilderService.build(options)
|
|
|
|
Statistics::Builders::MembersBuilderService.build(options)
|
|
|
|
Statistics::Builders::ProjectsBuilderService.build(options)
|
2022-10-11 15:14:53 +02:00
|
|
|
Statistics::Builders::StoreOrdersBuilderService.build(options)
|
2022-08-29 17:34:09 +02:00
|
|
|
end
|
2022-10-05 13:11:17 +02:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def default_options
|
|
|
|
yesterday = 1.day.ago
|
|
|
|
{
|
|
|
|
start_date: yesterday.beginning_of_day,
|
|
|
|
end_date: yesterday.end_of_day
|
|
|
|
}
|
|
|
|
end
|
2022-08-29 17:34:09 +02:00
|
|
|
end
|
|
|
|
end
|