mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Merge pull request #2075 from alphagov/statistics-endpoint
use service statistics endpoint instead of detailed service
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'}
|
||||
|
||||
@@ -246,7 +246,7 @@ def get_notifications(service_id, message_type, status_override=None):
|
||||
status_filters=get_status_filters(
|
||||
current_service,
|
||||
message_type,
|
||||
service_api_client.get_detailed_service(service_id)['data']['statistics']
|
||||
service_api_client.get_service_statistics(service_id, today_only=False)
|
||||
)
|
||||
),
|
||||
'notifications': render_template(
|
||||
|
||||
@@ -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