From f59e05fb1a159d31a7454d93f5c4190141595f3a Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Mon, 22 Aug 2016 12:35:34 +0100 Subject: [PATCH] Handle the API migration If it;s the new format API hide the results - Temp fix until new Admin code ships. Should be live for 5 mins. --- app/notify_client/template_statistics_api_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/notify_client/template_statistics_api_client.py b/app/notify_client/template_statistics_api_client.py index b0d54b22c..7ffbd291a 100644 --- a/app/notify_client/template_statistics_api_client.py +++ b/app/notify_client/template_statistics_api_client.py @@ -16,11 +16,17 @@ class TemplateStatisticsApiClient(BaseAPIClient): params = {} if limit_days is not None: params['limit_days'] = limit_days - return self.get( + + response = self.get( url='/service/{}/template-statistics'.format(service_id), params=params )['data'] + if len(response) > 0 and 'template' in response[0]: + return response + + return [] + def get_template_statistics_for_template(self, service_id, template_id): return self.get( url='/service/{}/template-statistics/{}'.format(service_id, template_id)