mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 14:29:51 -04:00
Break down usage by month, filter by year
The previous, weekly activity breakdown was what we reckoned might be useful. But now that we have people using the platform it feels like aggregating a service’s usage by month is: - matches the timeframe users report on within their organisation - is consistent with the usage page And like the usage page this commit also limits the page to only show one financial year’s worth of data at once (rather than data for all time). This commit also makes some changes to the jobs view code so that our aggregation of failure states is consistent between the dashboard pages and the jobs pages.
This commit is contained in:
@@ -31,8 +31,8 @@
|
||||
|
||||
{{ ajax_block(partials, updates_url, 'totals') }}
|
||||
{{ show_more(
|
||||
url_for('.weekly', service_id=current_service.id),
|
||||
'Compare to previous weeks'
|
||||
url_for('.monthly', service_id=current_service.id),
|
||||
'See activity breakdown'
|
||||
) }}
|
||||
|
||||
{% if partials['has_template_statistics'] %}
|
||||
|
||||
69
app/templates/views/dashboard/monthly.html
Normal file
69
app/templates/views/dashboard/monthly.html
Normal file
@@ -0,0 +1,69 @@
|
||||
{% from "components/big-number.html" import big_number_with_status, big_number %}
|
||||
{% from "components/pill.html" import pill %}
|
||||
{% from "components/table.html" import list_table, field, hidden_field_heading, right_aligned_field_heading, row_heading %}
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
{% block page_title %}
|
||||
Previous weeks – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">
|
||||
Activity breakdown
|
||||
</h1>
|
||||
<div class="bottom-gutter">
|
||||
{{ pill(
|
||||
'financial year',
|
||||
items=years,
|
||||
current_value=selected_year,
|
||||
big_number_args={'smallest': True},
|
||||
) }}
|
||||
</div>
|
||||
{% if months %}
|
||||
<div class="body-copy-table">
|
||||
{% call(month, row_index) list_table(
|
||||
months,
|
||||
caption="Total spend",
|
||||
caption_visible=False,
|
||||
empty_message='',
|
||||
field_headings=[
|
||||
'Month',
|
||||
'Emails',
|
||||
'Text messages',
|
||||
],
|
||||
field_headings_visible=False
|
||||
) %}
|
||||
{% call row_heading() %}
|
||||
{{ month.name }}
|
||||
{% endcall %}
|
||||
{% for counts, template_type in [
|
||||
(month.email_counts, 'email'),
|
||||
(month.sms_counts, 'sms')
|
||||
] %}
|
||||
{% call field(align='left') %}
|
||||
{{ big_number(
|
||||
counts.requested,
|
||||
message_count_label(counts.requested, template_type, suffix=''),
|
||||
smallest=True,
|
||||
) }}
|
||||
{% if counts.requested %}
|
||||
<span class="{{ 'failure-highlight' if counts.show_warning else '' }}">
|
||||
{{ counts.failed }} failed
|
||||
</span>
|
||||
{% else %}
|
||||
–
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% endfor %}
|
||||
{% endcall %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<p class="align-with-heading-copy">
|
||||
Financial year ends 31 March.
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,50 +0,0 @@
|
||||
{% from "components/table.html" import list_table, field, hidden_field_heading, right_aligned_field_heading %}
|
||||
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
{% block page_title %}
|
||||
Previous weeks – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">
|
||||
Previous weeks
|
||||
</h1>
|
||||
{% call(item, row_number) list_table(
|
||||
days,
|
||||
caption="Daily",
|
||||
caption_visible=False,
|
||||
empty_message='No data found',
|
||||
field_headings=[
|
||||
hidden_field_heading('Day'),
|
||||
right_aligned_field_heading('Emails'),
|
||||
right_aligned_field_heading('Failure rate'),
|
||||
right_aligned_field_heading('Text messages'),
|
||||
right_aligned_field_heading('Failure rate')
|
||||
]
|
||||
) %}
|
||||
{% call field() %}
|
||||
{{ item.week_start|format_date_short }} to
|
||||
{% if item.week_end_datetime > now %}
|
||||
today
|
||||
{% else %}
|
||||
{{ item.week_end|format_date_short }}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
{{ item.email.requested }}
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
{{ item.email.failure_rate }}%
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
{{ item.sms.requested }}
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
{{ item.sms.failure_rate }}%
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user