Don’t break statistics down by sending/failed/delivered

This should:
- make the page load faster because it has to render less HTML for each
  service
- make the page easier to scan for services that are sending lots of
  text messages or letters

We used to scan this page to look for services with high failure rates,
and the design of the page was gear towards this. Now we have alerting
for high failure rates, so the page can focus on volumes instead.

This commit also puts the service name above the statistics, so that
long service names don’t break the layout of the page.
This commit is contained in:
Chris Hill-Scott
2020-06-24 11:20:22 +01:00
parent 2762be233d
commit fb4076dc5b
3 changed files with 35 additions and 126 deletions

View File

@@ -505,14 +505,7 @@ def format_stats_by_service(services):
yield {
'id': service['id'],
'name': service['name'],
'stats': {
msg_type: {
'sending': stats['requested'] - stats['delivered'] - stats['failed'],
'delivered': stats['delivered'],
'failed': stats['failed'],
}
for msg_type, stats in service['statistics'].items()
},
'stats': service['statistics'],
'restricted': service['restricted'],
'research_mode': service['research_mode'],
'created_at': service['created_at'],

View File

@@ -9,38 +9,16 @@
{% from "components/button/macro.njk" import govukButton %}
{% from "components/details/macro.njk" import govukDetails %}
{% macro stats_fields(channel, data) -%}
{% call field(border=False) %}
<span class="heading-medium">{{ channel.title() }}</span>
{% endcall %}
{% call field(align='right', border=False) %}
{{ big_number(data[channel]['sending'], smaller=True) }}
{% endcall %}
{% call field(align='right', border=False) %}
{{ big_number(data[channel]['delivered'], smaller=True) }}
{% endcall %}
{% call field(align='right', status='error' if data[channel]['failed'], border=False) %}
{{ big_number(data[channel]['failed'], smaller=True) }}
{% endcall %}
{%- endmacro %}
{% macro services_table(services, caption) %}
{% call(item, row_number) mapping_table(
caption=caption,
caption_visible=False,
field_headings=[
'Service',
hidden_field_heading('Type'),
right_aligned_field_heading('Sending'),
right_aligned_field_heading('Delivered'),
right_aligned_field_heading('Failed')
right_aligned_field_heading('Emails'),
right_aligned_field_heading('Text messages'),
right_aligned_field_heading('Letters')
],
field_headings_visible=True
field_headings_visible=False,
) %}
{% for service in services %}
@@ -48,30 +26,25 @@
{% call row_group() %}
{% call row() %}
{% call field(border=False) %}
<a href="{{ url_for('main.service_dashboard', service_id=service['id']) }}" class="govuk-link govuk-link--no-visited-state browse-list-link">{{ service['name'] }}</a>
{% call field(border=False, colspan=3) %}
<a href="{{ url_for('main.service_dashboard', service_id=service['id']) }}" class="file-list-filename-large govuk-link govuk-link--no-visited-state govuk-!-padding-bottom-4">{{ service['name'] }}</a>
{% if not service['active'] %}
<span class="heading-medium hint">&ensp;Archived</span>
{% endif %}
{% endcall %}
{{ stats_fields('email', service['stats']) }}
{% endcall %}
{% call row() %}
{% call field(border=False) %}
{% endcall %}
{{ stats_fields('sms', service['stats']) }}
{% endcall %}
{% call row() %}
{% call field(border=False) %}
{% endcall %}
{{ stats_fields('letter', service['stats']) }}
{% for channel in ('email', 'sms', 'letter') %}
{% call field(border=False) %}
{{ big_number(
service['stats'][channel]['requested'],
smallest=True,
label=message_count_label(service['stats'][channel]['requested'], channel)
) }}
{% endcall %}
{% endfor %}
{% endcall %}
{% endcall %}