mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
Merge pull request #3167 from alphagov/hide-len-1-template-statistics
Don’t show template statistics on dashboard if only one template has been used
This commit is contained in:
@@ -334,7 +334,6 @@ def get_dashboard_partials(service_id):
|
||||
[row['count'] for row in template_statistics] or [0]
|
||||
),
|
||||
),
|
||||
'has_template_statistics': bool(template_statistics),
|
||||
'jobs': render_template(
|
||||
'views/dashboard/_jobs.html',
|
||||
jobs=immediate_jobs
|
||||
|
||||
@@ -33,13 +33,7 @@
|
||||
'See messages sent per month'
|
||||
) }}
|
||||
|
||||
{% if partials['has_template_statistics'] %}
|
||||
{{ ajax_block(partials, updates_url, 'template-statistics', interval=5) }}
|
||||
{{ show_more(
|
||||
url_for('.template_usage', service_id=current_service.id),
|
||||
'See templates used by month'
|
||||
) }}
|
||||
{% endif %}
|
||||
{{ ajax_block(partials, updates_url, 'template-statistics', interval=5) }}
|
||||
|
||||
{% if partials['has_jobs'] %}
|
||||
{{ ajax_block(partials, updates_url, 'jobs', interval=5) }}
|
||||
|
||||
@@ -2,46 +2,44 @@
|
||||
{% from "components/message-count-label.html" import message_count_label %}
|
||||
{% from "components/big-number.html" import big_number %}
|
||||
{% from "components/table.html" import list_table, field, right_aligned_field_heading, row_heading, spark_bar_field %}
|
||||
{% from "components/show-more.html" import show_more %}
|
||||
|
||||
<div class='dashboard-table'>
|
||||
{% call(item, row_number) list_table(
|
||||
template_statistics,
|
||||
caption="Templates used",
|
||||
caption_visible=False,
|
||||
empty_message='',
|
||||
field_headings=[
|
||||
'Template',
|
||||
'Messages sent'
|
||||
],
|
||||
field_headings_visible=True
|
||||
) %}
|
||||
<div class="ajax-block-container">
|
||||
{% if template_statistics|length > 1 %}
|
||||
<div class='dashboard-table'>
|
||||
{% call(item, row_number) list_table(
|
||||
template_statistics,
|
||||
caption="Templates used",
|
||||
caption_visible=False,
|
||||
empty_message='',
|
||||
field_headings=[
|
||||
'Template',
|
||||
'Messages sent'
|
||||
],
|
||||
field_headings_visible=True
|
||||
) %}
|
||||
|
||||
{% call row_heading() %}
|
||||
{% if item.is_precompiled_letter %}
|
||||
<span class="file-list-filename">
|
||||
Provided as PDF
|
||||
</span>
|
||||
<span class="file-list-hint">
|
||||
Letter
|
||||
</span>
|
||||
{% else %}
|
||||
<a class="file-list-filename" href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template_id) }}">{{ item.template_name }}</a>
|
||||
<span class="file-list-hint">
|
||||
{{ message_count_label(1, item.template_type, suffix='template')|capitalize }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{% if template_statistics|length > 1 %}
|
||||
{{ spark_bar_field(item.count, most_used_template_count, id=item.template_id) }}
|
||||
{% else %}
|
||||
{% call field() %}
|
||||
<span id='{{item.template_id}}' class="heading-small">
|
||||
{{ big_number(
|
||||
item.count,
|
||||
smallest=True
|
||||
) }}
|
||||
</span>
|
||||
{% call row_heading() %}
|
||||
{% if item.is_precompiled_letter %}
|
||||
<span class="file-list-filename">
|
||||
Provided as PDF
|
||||
</span>
|
||||
<span class="file-list-hint">
|
||||
Letter
|
||||
</span>
|
||||
{% else %}
|
||||
<a class="file-list-filename" href="{{ url_for('.view_template', service_id=current_service.id, template_id=item.template_id) }}">{{ item.template_name }}</a>
|
||||
<span class="file-list-hint">
|
||||
{{ message_count_label(1, item.template_type, suffix='template')|capitalize }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{{ spark_bar_field(item.count, most_used_template_count, id=item.template_id) }}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
{% endcall %}
|
||||
{{ show_more(
|
||||
url_for('.template_usage', service_id=current_service.id),
|
||||
'See templates used by month'
|
||||
) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user