Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add letter counts to the platform admin page. #1600

Merged
merged 1 commit into from
Nov 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/main/views/platform_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ def create_global_stats(services):
'requested': 0
}
}

for service in services:
for msg_type, status in itertools.product(('sms', 'email', 'letter'), ('delivered', 'failed', 'requested')):
stats[msg_type][status] += service['statistics'][msg_type][status]
Expand Down
4 changes: 2 additions & 2 deletions app/templates/views/platform-admin/_global_stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</div>
<div class="column-third">
{{ big_number_with_status(
global_stats.letter.delivered + global_stats.letter.failed,
message_count_label(global_stats.letter.delivered, 'letter'),
global_stats.letter.requested,
message_count_label(global_stats.letter.requested, 'letter'),
global_stats.letter.failed,
global_stats.letter.failure_rate,
global_stats.letter.failure_rate|float > 3,
Expand Down
13 changes: 11 additions & 2 deletions app/templates/views/platform-admin/services.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@

{% call row() %}
{% if not service['active'] %}
{% call field(status='default') %}
{% call field(status='default', border=False) %}
<span class="heading-medium">archived</span>
{% endcall %}
{% elif service['research_mode'] %}
{% call field(border=False) %}
<span class="research-mode">research mode</span>
{% endcall %}
{% elif not service['restricted'] %}
{% call field(status='error') %}
{% call field(status='error', border=False) %}
<span class="heading-medium">Live</span>
{% endcall %}
{% else %}
Expand All @@ -72,6 +72,15 @@
{{ stats_fields('sms', service['stats']) }}
{% endcall %}

{% call row() %}

{% call field(border=False) %}

{% endcall %}
{{ stats_fields('letter', service['stats']) }}

{% endcall %}

{% endcall %}

{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions tests/app/main/views/test_platform_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_should_render_platform_admin_page(
response = client.get(url_for(endpoint))
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert len(page.select('tbody tr')) == expected_services_shown * 2 # one row for SMS, one for email
assert len(page.select('tbody tr')) == expected_services_shown * 3 # one row for SMS, one for email, one for letter
mock_get_detailed_services.assert_called_once_with({'detailed': True,
'include_from_test_key': True,
'only_active': False})
Expand Down Expand Up @@ -543,7 +543,7 @@ def test_should_show_correct_sent_totals_for_platform_admin(

assert email_total == 60
assert sms_total == 40
assert letter_total == 45
assert letter_total == 60


@pytest.mark.parametrize('endpoint, restricted, research_mode', [
Expand Down