mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 17:33:12 -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:
@@ -287,13 +287,13 @@ def get_dashboard_partials(service_id):
|
||||
add_rate_to_job(job)
|
||||
for job in job_api_client.get_jobs(service_id, limit_days=7, statuses=statuses_to_display)['data']
|
||||
]
|
||||
service = service_api_client.get_detailed_service(service_id)
|
||||
stats = service_api_client.get_service_statistics(service_id, today_only=False)
|
||||
column_width, max_notifiction_count = get_column_properties(
|
||||
number_of_columns=(
|
||||
3 if 'letter' in current_service['permissions'] else 2
|
||||
)
|
||||
)
|
||||
dashboard_totals = get_dashboard_totals(service['data']['statistics']),
|
||||
dashboard_totals = get_dashboard_totals(stats),
|
||||
highest_notification_count = max(
|
||||
sum(
|
||||
value[key] for key in {'requested', 'failed', 'delivered'}
|
||||
|
||||
Reference in New Issue
Block a user