mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
use service statistics endpoint instead of detailed service
we're not actually looking at the detailed service aspects - just the stats. We're doing this in three places: * dashboard * notification activity page * when checking jobs to see if we're over the daily limit change these places to use a new api endpoint (service/id/statistics), which hopefully be a little more performant, and will definitely be a little more organised - moving away from generic endpoints with loads of optional parameters. We still need the detailed endpoints for the platform admin page tho. Depends on https://github.com/alphagov/notifications-api/pull/1865
This commit is contained in:
@@ -498,7 +498,7 @@ def _check_messages(service_id, template_id, upload_id, preview_row, letters_as_
|
||||
|
||||
users = user_api_client.get_users_for_service(service_id=service_id)
|
||||
|
||||
statistics = service_api_client.get_detailed_service_for_today(service_id)['data']['statistics']
|
||||
statistics = service_api_client.get_service_statistics(service_id, today_only=True)
|
||||
remaining_messages = (current_service['message_limit'] - sum(stat['requested'] for stat in statistics.values()))
|
||||
|
||||
contents = s3download(service_id, upload_id)
|
||||
|
||||
Reference in New Issue
Block a user