mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-05 16:24:21 +01:00
24 lines
947 B
Ruby
24 lines
947 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Generate statistics indicators about subscriptions
|
|
class Statistics::Builders::SubscriptionsBuilderService
|
|
include Statistics::Concerns::HelpersConcern
|
|
|
|
class << self
|
|
def build(options = default_options)
|
|
# subscription list
|
|
Statistics::FetcherService.subscriptions_list(options).each do |s|
|
|
Stats::Subscription.create({ date: format_date(s[:date]),
|
|
type: s[:duration],
|
|
subType: s[:slug],
|
|
stat: 1,
|
|
ca: s[:ca],
|
|
planId: s[:plan_id],
|
|
subscriptionId: s[:subscription_id],
|
|
invoiceItemId: s[:invoice_item_id],
|
|
groupName: s[:plan_group_name] }.merge(user_info_stat(s)))
|
|
end
|
|
end
|
|
end
|
|
end
|