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.
This commit is contained in:
Martyn Inglis
2016-08-22 12:35:34 +01:00
parent e610d83be4
commit f59e05fb1a

View File

@@ -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)