Use statistics for returned letters on dashboard

This should be faster and more accurate than querying all the reports.
This commit is contained in:
Chris Hill-Scott
2020-03-03 17:40:50 +00:00
parent c3fa8ab2e1
commit 7fb8e1de92
10 changed files with 102 additions and 83 deletions

View File

@@ -335,6 +335,25 @@ def test_client_returns_count_of_service_templates(
],
{'data_from': 'api'},
),
(
service_api_client.get_returned_letter_statistics,
[SERVICE_ONE_ID],
[
call('service-{}-returned-letters-statistics'.format(SERVICE_ONE_ID))
],
None,
[
call('service/{}/returned-letter-statistics'.format(SERVICE_ONE_ID))
],
[
call(
'service-{}-returned-letters-statistics'.format(SERVICE_ONE_ID),
'{"data_from": "api"}',
ex=604800,
)
],
{'data_from': 'api'},
),
]
)
def test_returns_value_from_cache(