mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Merge pull request #499 from alphagov/dashboard-duration
Fix the big numbers on the dashboard
This commit is contained in:
@@ -57,6 +57,7 @@ def service_dashboard(service_id):
|
|||||||
|
|
||||||
@main.route("/services/<service_id>/dashboard.json")
|
@main.route("/services/<service_id>/dashboard.json")
|
||||||
@login_required
|
@login_required
|
||||||
|
@user_has_permissions('view_activity', admin_override=True)
|
||||||
def service_dashboard_updates(service_id):
|
def service_dashboard_updates(service_id):
|
||||||
return jsonify(**{
|
return jsonify(**{
|
||||||
'today': render_template(
|
'today': render_template(
|
||||||
|
|||||||
@@ -18,4 +18,5 @@ class StatisticsApiClient(BaseAPIClient):
|
|||||||
params['limit_days'] = limit_days
|
params['limit_days'] = limit_days
|
||||||
return self.get(
|
return self.get(
|
||||||
url='/service/{}/notifications-statistics'.format(service_id),
|
url='/service/{}/notifications-statistics'.format(service_id),
|
||||||
|
params=params
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
{% macro big_number(number, label) %}
|
{% macro big_number(number, label) %}
|
||||||
<div class="big-number">
|
<div class="big-number{% if right_aligned %}-right-aligned{% endif %}">
|
||||||
{{ number }}
|
{% if number is number %}
|
||||||
|
{{ "{:,}".format(number) }}
|
||||||
|
{% else %}
|
||||||
|
{{ number }}
|
||||||
|
{% endif %}
|
||||||
<span class="big-number-label">{{ label }}</span>
|
<span class="big-number-label">{{ label }}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
@@ -13,10 +17,10 @@
|
|||||||
{% if failures %}
|
{% if failures %}
|
||||||
{% if failure_link %}
|
{% if failure_link %}
|
||||||
<a href="{{ failure_link }}">
|
<a href="{{ failure_link }}">
|
||||||
{{ failures }} failed – {{ failure_percentage }}%
|
{{ "{:,}".format(failures) }} failed – {{ failure_percentage }}%
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ failures }} failed – {{ failure_percentage }}%
|
{{ "{:,}".format(failures) }} failed – {{ failure_percentage }}%
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
No failures
|
No failures
|
||||||
|
|||||||
@@ -14,4 +14,18 @@ def test_notifications_statistics_client_calls_correct_api_endpoint(mocker, api_
|
|||||||
|
|
||||||
client.get_statistics_for_service(some_service_id)
|
client.get_statistics_for_service(some_service_id)
|
||||||
|
|
||||||
mock_get.assert_called_once_with(url=expected_url)
|
mock_get.assert_called_once_with(url=expected_url, params={})
|
||||||
|
|
||||||
|
|
||||||
|
def test_notifications_statistics_client_calls_correct_api_endpoint_with_params(mocker, api_user_active):
|
||||||
|
|
||||||
|
some_service_id = uuid.uuid4()
|
||||||
|
expected_url = '/service/{}/notifications-statistics'.format(some_service_id)
|
||||||
|
|
||||||
|
client = StatisticsApiClient()
|
||||||
|
|
||||||
|
mock_get = mocker.patch('app.notify_client.statistics_api_client.StatisticsApiClient.get')
|
||||||
|
|
||||||
|
client.get_statistics_for_service(some_service_id, limit_days=99)
|
||||||
|
|
||||||
|
mock_get.assert_called_once_with(url=expected_url, params={'limit_days': 99})
|
||||||
|
|||||||
Reference in New Issue
Block a user