Show template usage for all time on it’s own page

> We show the last weeks template usage on the dashboard, which is
> great, but if you're looking for longer term trends, you're out of
> luck...

> So, let's let you see more on a more detailed page (linked from the
> dashboard). Initially this should just show you all templates that you
> have used ever and the count for each. Order same as dashboard, most
> popular first.

https://www.pivotaltracker.com/story/show/117614585
This commit is contained in:
Chris Hill-Scott
2016-04-20 14:09:38 +01:00
parent 312a903e65
commit 09491e880e
5 changed files with 80 additions and 4 deletions

View File

@@ -54,6 +54,18 @@ def service_dashboard_updates(service_id):
})
@main.route("/services/<service_id>/template-activity")
@login_required
@user_has_permissions('view_activity', admin_override=True)
def template_history(service_id):
return render_template(
'views/dashboard/all-template-statistics.html',
template_statistics=aggregate_usage(
template_statistics_client.get_template_statistics_for_service(service_id)
)
)
def add_rates_to(delivery_statistics):
if not delivery_statistics or not delivery_statistics[0]:
@@ -125,4 +137,4 @@ def get_dashboard_statistics_for_service(service_id):
'template_statistics': aggregate_usage(
template_statistics_client.get_template_statistics_for_service(service_id, limit_days=7)
)
}
}

View File

@@ -0,0 +1,17 @@
{% extends "withnav_template.html" %}
{% block page_title %}
{{ current_service.name }} GOV.UK Notify
{% endblock %}
{% block maincolumn_content %}
<h1 class='heading-large'>
Templates used this year
</h1>
<p>
1 April 2016 to date
</p>
{% with period = "" %}
{% include 'views/dashboard/template-statistics.html' %}
{% endwith %}
{% endblock %}

View File

@@ -3,7 +3,7 @@
template_statistics,
caption="By template",
caption_visible=False,
empty_message='You havent set up any templates yet',
empty_message='You havent used any templates {}'.format(period),
field_headings=['Template', hidden_field_heading('Type'), right_aligned_field_heading('Messages processed')]
) %}
{% call field() %}

View File

@@ -25,5 +25,9 @@
) }}
</div>
</div>
{% include 'views/dashboard/template-statistics.html' %}
{% with period = "in the last 7 days" %}
{% include 'views/dashboard/template-statistics.html' %}
{% endwith %}
<p class='table-show-more-link'>
<a href="{{ url_for('.template_history', service_id=current_service.id) }}">See all templates used this year</a>
</p>