Revert "Restyle template statistics and received text messages"

This commit is contained in:
Chris Hill-Scott
2020-02-18 14:58:33 +00:00
committed by GitHub
parent a86f0a6efc
commit 6bdd776780
15 changed files with 114 additions and 186 deletions

View File

@@ -280,8 +280,15 @@ def get_dashboard_partials(service_id):
all_statistics = template_statistics_client.get_template_statistics_for_service(service_id, limit_days=7)
template_statistics = aggregate_template_usage(all_statistics)
stats = aggregate_notifications_stats(all_statistics)
column_width, max_notifiction_count = get_column_properties(3)
dashboard_totals = get_dashboard_totals(stats),
highest_notification_count = max(
sum(
value[key] for key in {'requested', 'failed', 'delivered'}
)
for key, value in dashboard_totals[0].items()
)
free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year(
current_service.id,
get_current_financial_year(),
@@ -305,6 +312,10 @@ def get_dashboard_partials(service_id):
'views/dashboard/_totals.html',
service_id=service_id,
statistics=dashboard_totals[0],
column_width=column_width,
smaller_font_size=(
highest_notification_count > max_notifiction_count
),
),
'template-statistics': render_template(
'views/dashboard/template-statistics.html',
@@ -319,6 +330,7 @@ def get_dashboard_partials(service_id):
),
'usage': render_template(
'views/dashboard/_usage.html',
column_width=column_width,
**calculate_usage(yearly_usage, free_sms_allowance),
),
}
@@ -493,3 +505,10 @@ def get_tuples_of_financial_years(
)
for year in range(start, end + 1)
)
def get_column_properties(number_of_columns):
return {
2: ('column-half', 999999999),
3: ('column-third', 99999),
}.get(number_of_columns)