mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-09 14:59:49 -04:00
move away from statistics_api towards service_api
This commit is contained in:
@@ -15,7 +15,6 @@ from flask_login import login_required
|
|||||||
from app.main import main
|
from app.main import main
|
||||||
from app import (
|
from app import (
|
||||||
job_api_client,
|
job_api_client,
|
||||||
statistics_api_client,
|
|
||||||
service_api_client,
|
service_api_client,
|
||||||
template_statistics_client
|
template_statistics_client
|
||||||
)
|
)
|
||||||
@@ -90,7 +89,7 @@ def usage(service_id):
|
|||||||
@login_required
|
@login_required
|
||||||
@user_has_permissions('manage_settings', admin_override=True)
|
@user_has_permissions('manage_settings', admin_override=True)
|
||||||
def weekly(service_id):
|
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(
|
return render_template(
|
||||||
'views/weekly.html',
|
'views/weekly.html',
|
||||||
days=format_weekly_stats_to_list(stats),
|
days=format_weekly_stats_to_list(stats),
|
||||||
|
|||||||
@@ -193,6 +193,9 @@ class ServiceAPIClient(NotificationsAPIClient):
|
|||||||
def get_service_usage(self, service_id):
|
def get_service_usage(self, service_id):
|
||||||
return self.get('/service/{0}/fragment/aggregate_statistics'.format(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):
|
class ServicesBrowsableItem(BrowsableItem):
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ class StatisticsApiClient(BaseAPIClient):
|
|||||||
else:
|
else:
|
||||||
raise e
|
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):
|
def get_statistics_for_all_services_for_day(self, day):
|
||||||
params = {
|
params = {
|
||||||
'day': day
|
'day': day
|
||||||
|
|||||||
Reference in New Issue
Block a user