2022-08-29 17:34:09 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Generate statistics indicators about members
|
|
|
|
class Statistics::Builders::MembersBuilderService
|
|
|
|
include Statistics::Concerns::HelpersConcern
|
|
|
|
|
|
|
|
class << self
|
|
|
|
def build(options = default_options)
|
|
|
|
# account list
|
2023-02-02 15:43:05 +01:00
|
|
|
Statistics::FetcherService.each_member(options) do |m|
|
2022-08-29 17:34:09 +02:00
|
|
|
Stats::Account.create({ date: format_date(m[:date]),
|
|
|
|
type: 'member',
|
|
|
|
subType: 'created',
|
2023-09-01 12:43:36 +02:00
|
|
|
stat: 1,
|
|
|
|
groupName: m[:groupName] }.merge(user_info_stat(m)))
|
2022-08-29 17:34:09 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# member ca list
|
|
|
|
Statistics::FetcherService.members_ca_list(options).each do |m|
|
|
|
|
Stats::User.create({ date: format_date(m[:date]),
|
|
|
|
type: 'revenue',
|
|
|
|
subType: m[:group],
|
2023-09-01 12:43:36 +02:00
|
|
|
stat: m[:ca],
|
|
|
|
groupName: m[:groupName] }.merge(user_info_stat(m)))
|
2022-08-29 17:34:09 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|