mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-11 05:43:44 -05: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")
|
||||
@login_required
|
||||
@user_has_permissions('view_activity', admin_override=True)
|
||||
def service_dashboard_updates(service_id):
|
||||
return jsonify(**{
|
||||
'today': render_template(
|
||||
|
||||
@@ -18,4 +18,5 @@ class StatisticsApiClient(BaseAPIClient):
|
||||
params['limit_days'] = limit_days
|
||||
return self.get(
|
||||
url='/service/{}/notifications-statistics'.format(service_id),
|
||||
params=params
|
||||
)
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
{% macro big_number(number, label) %}
|
||||
<div class="big-number">
|
||||
{{ number }}
|
||||
<div class="big-number{% if right_aligned %}-right-aligned{% endif %}">
|
||||
{% if number is number %}
|
||||
{{ "{:,}".format(number) }}
|
||||
{% else %}
|
||||
{{ number }}
|
||||
{% endif %}
|
||||
<span class="big-number-label">{{ label }}</span>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -13,10 +17,10 @@
|
||||
{% if failures %}
|
||||
{% if failure_link %}
|
||||
<a href="{{ failure_link }}">
|
||||
{{ failures }} failed – {{ failure_percentage }}%
|
||||
{{ "{:,}".format(failures) }} failed – {{ failure_percentage }}%
|
||||
</a>
|
||||
{% else %}
|
||||
{{ failures }} failed – {{ failure_percentage }}%
|
||||
{{ "{:,}".format(failures) }} failed – {{ failure_percentage }}%
|
||||
{% endif %}
|
||||
{% else %}
|
||||
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)
|
||||
|
||||
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