23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'app/controllers/aviate/usage_controller.rb', line 23
def show
cached_options = options_for_klient
subscription_id = params.require(:id)
@subscription = Kaui::Subscription.find_by_id(subscription_id, 'NONE', cached_options)
@account_id = @subscription.account_id
@account = Kaui::Account.find_by_id(@account_id, false, false, cached_options)
start_date, end_date = billing_period(@subscription)
@period_start = format_date(start_date)
@period_end = format_date(end_date)
@period_closed = end_date < Time.zone.today
unit_types = fetch_unit_types(@subscription, start_date, cached_options)
samples_by_unit = fetch_all_samples(subscription_id, unit_types, start_date, end_date, cached_options)
@chart_data = build_chart_data(samples_by_unit, unit_types)
@accrued_cost = fetch_accrued_cost(@account_id, cached_options)
@wallet_balance = fetch_wallet_balance(@account_id, cached_options)
@chart_json = build_chart_json(@chart_data)
end
|