mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 00:33:58 -04:00
Fix download csv to use the service data retention if it exists.
This commit is contained in:
@@ -23,6 +23,7 @@ from app import (
|
|||||||
format_date_numeric,
|
format_date_numeric,
|
||||||
job_api_client,
|
job_api_client,
|
||||||
notification_api_client,
|
notification_api_client,
|
||||||
|
service_api_client,
|
||||||
)
|
)
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app.notify_client.api_key_api_client import KEY_TYPE_TEST
|
from app.notify_client.api_key_api_client import KEY_TYPE_TEST
|
||||||
@@ -167,6 +168,9 @@ def download_notifications_csv(service_id):
|
|||||||
filter_args = parse_filter_args(request.args)
|
filter_args = parse_filter_args(request.args)
|
||||||
filter_args['status'] = set_status_filters(filter_args)
|
filter_args['status'] = set_status_filters(filter_args)
|
||||||
|
|
||||||
|
service_data_retention_days = service_api_client.get_service_data_retention_by_notification_type(
|
||||||
|
service_id, filter_args.get('message_type')[0]
|
||||||
|
).get('days_of_retention', current_app.config['ACTIVITY_STATS_LIMIT_DAYS'])
|
||||||
return Response(
|
return Response(
|
||||||
stream_with_context(
|
stream_with_context(
|
||||||
generate_notifications_csv(
|
generate_notifications_csv(
|
||||||
@@ -177,7 +181,7 @@ def download_notifications_csv(service_id):
|
|||||||
page_size=10000,
|
page_size=10000,
|
||||||
format_for_csv=True,
|
format_for_csv=True,
|
||||||
template_type=filter_args.get('message_type'),
|
template_type=filter_args.get('message_type'),
|
||||||
limit_days=current_app.config['ACTIVITY_STATS_LIMIT_DAYS'],
|
limit_days=service_data_retention_days,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
mimetype='text/csv',
|
mimetype='text/csv',
|
||||||
|
|||||||
Reference in New Issue
Block a user