From f8fab35ee7c056119a25f136f31e281f09d085b0 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Wed, 20 Sep 2017 14:38:15 +0100 Subject: [PATCH] show letters as accepted, not created or sending, on the api page --- app/main/views/api_keys.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index ba6a83a18..ca7329d9d 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -13,13 +13,18 @@ from app.notify_client.api_key_api_client import KEY_TYPE_NORMAL, KEY_TYPE_TEST, def api_integration(service_id): return render_template( 'views/api/index.html', - api_notifications=notification_api_client.get_notifications_for_service( + api_notifications=map_letters_to_accepted(notification_api_client.get_notifications_for_service( service_id=service_id, include_jobs=False, include_from_test_key=True - ) + )) ) +def map_letters_to_accepted(notifications): + for notification in notifications['notifications']: + if notification['notification_type'] == 'letter' and notification['status'] in ('created', 'sending'): + notification['status'] = 'accepted' + return notifications @main.route("/services//api/documentation") @login_required