mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-21 14:59:47 -04:00
The yearly usage section on the dashboard page takes too log as a result services with large yearly stats are timing out.
As a short term fix we have taken the yearly stats off the dashboard. There is a plan to create permanent statistic tables to warehouse the data.
This commit is contained in:
@@ -219,14 +219,7 @@ def get_dashboard_partials(service_id):
|
||||
'views/dashboard/_jobs.html',
|
||||
jobs=immediate_jobs
|
||||
),
|
||||
'has_jobs': bool(immediate_jobs),
|
||||
'usage': render_template(
|
||||
'views/dashboard/_usage.html',
|
||||
**calculate_free_tier_usage(service_api_client.get_yearly_sms_unit_count_and_cost(
|
||||
service_id,
|
||||
get_current_financial_year(),
|
||||
), service)
|
||||
),
|
||||
'has_jobs': bool(immediate_jobs)
|
||||
}
|
||||
|
||||
|
||||
@@ -237,16 +230,6 @@ def get_dashboard_totals(statistics):
|
||||
return statistics
|
||||
|
||||
|
||||
def calculate_free_tier_usage(usage, service):
|
||||
sms_free_allowance = service['data']['free_sms_fragment_limit']
|
||||
return({
|
||||
'sms_chargeable': max(0, usage['billable_sms_units'] - sms_free_allowance),
|
||||
'total_sms_bill': usage['billable_sms_units'],
|
||||
'total_sms_cost': usage['total_cost'],
|
||||
'sms_allowance_remaining': sms_free_allowance - int(usage['billable_sms_units'])
|
||||
})
|
||||
|
||||
|
||||
def calculate_usage(usage):
|
||||
# TODO: Don't hardcode these - get em from the API
|
||||
sms_free_allowance = 250000
|
||||
|
||||
Reference in New Issue
Block a user