From 4ea23a7484ad8c7f001e7fb9ac2b1ce42366c627 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Fri, 29 Jul 2016 10:28:18 +0100 Subject: [PATCH] move away from statistics_api towards service_api --- app/main/views/dashboard.py | 3 +-- app/notify_client/service_api_client.py | 3 +++ app/notify_client/statistics_api_client.py | 3 --- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/main/views/dashboard.py b/app/main/views/dashboard.py index 29c2232be..67588672a 100644 --- a/app/main/views/dashboard.py +++ b/app/main/views/dashboard.py @@ -15,7 +15,6 @@ from flask_login import login_required from app.main import main from app import ( job_api_client, - statistics_api_client, service_api_client, template_statistics_client ) @@ -90,7 +89,7 @@ def usage(service_id): @login_required @user_has_permissions('manage_settings', admin_override=True) def weekly(service_id): - stats = statistics_api_client.get_weekly_notification_stats(service_id)['data'] + stats = service_api_client.get_weekly_notification_stats(service_id)['data'] return render_template( 'views/weekly.html', days=format_weekly_stats_to_list(stats), diff --git a/app/notify_client/service_api_client.py b/app/notify_client/service_api_client.py index f2896a49e..230c53b3e 100644 --- a/app/notify_client/service_api_client.py +++ b/app/notify_client/service_api_client.py @@ -193,6 +193,9 @@ class ServiceAPIClient(NotificationsAPIClient): def get_service_usage(self, service_id): return self.get('/service/{0}/fragment/aggregate_statistics'.format(service_id)) + def get_weekly_notification_stats(self, service_id): + return self.get(url='/service/{}/notifications/weekly'.format(service_id)) + class ServicesBrowsableItem(BrowsableItem): @property diff --git a/app/notify_client/statistics_api_client.py b/app/notify_client/statistics_api_client.py index 47f5b89e4..ba1a6c496 100644 --- a/app/notify_client/statistics_api_client.py +++ b/app/notify_client/statistics_api_client.py @@ -23,9 +23,6 @@ class StatisticsApiClient(BaseAPIClient): else: raise e - def get_weekly_notification_stats(self, service_id): - return self.get(url='/service/{}/notifications/weekly'.format(service_id)) - def get_statistics_for_all_services_for_day(self, day): params = { 'day': day