Merge pull request #1109 from alphagov/usage-by-year-2

Break down usage by month, filter by year
This commit is contained in:
Chris Hill-Scott
2017-02-09 09:36:23 +00:00
committed by GitHub
11 changed files with 217 additions and 124 deletions

View File

@@ -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'] %}

View File

@@ -0,0 +1,71 @@
{% 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
) %}
{% if not month.future %}
{% 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 %}
{% endif %}
{% endcall %}
</div>
{% endif %}
<p class="align-with-heading-copy">
Financial year ends 31 March.
</p>
{% endblock %}

View File

@@ -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 %}