mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Added letters info to service / admin dashboard & activity page
This commit is contained in:
@@ -215,6 +215,7 @@ def get_dashboard_partials(service_id):
|
||||
for job in job_api_client.get_jobs(service_id, limit_days=7, statuses=statuses_to_display)['data']
|
||||
]
|
||||
service = service_api_client.get_detailed_service(service_id)
|
||||
column_width = 'column-third' if 'letter' in current_service['permissions'] else 'column-half'
|
||||
|
||||
return {
|
||||
'upcoming': render_template(
|
||||
@@ -231,7 +232,8 @@ def get_dashboard_partials(service_id):
|
||||
'totals': render_template(
|
||||
'views/dashboard/_totals.html',
|
||||
service_id=service_id,
|
||||
statistics=get_dashboard_totals(service['data']['statistics'])
|
||||
statistics=get_dashboard_totals(service['data']['statistics']),
|
||||
column_width=column_width
|
||||
),
|
||||
'template-statistics': render_template(
|
||||
'views/dashboard/template-statistics.html',
|
||||
|
||||
@@ -225,7 +225,7 @@ def get_notifications(service_id, message_type, status_override=None):
|
||||
page = get_page_from_request()
|
||||
if page is None:
|
||||
abort(404, "Invalid page argument ({}) reverting to page 1.".format(request.args['page'], None))
|
||||
if message_type not in ['email', 'sms']:
|
||||
if message_type not in ['email', 'sms', 'letter']:
|
||||
abort(404)
|
||||
filter_args = _parse_filter_args(request.args)
|
||||
filter_args['status'] = _set_status_filters(filter_args)
|
||||
@@ -243,7 +243,6 @@ def get_notifications(service_id, message_type, status_override=None):
|
||||
headers={
|
||||
'Content-Disposition': 'inline; filename="notifications.csv"'}
|
||||
)
|
||||
|
||||
notifications = notification_api_client.get_notifications_for_service(
|
||||
service_id=service_id,
|
||||
page=page,
|
||||
|
||||
@@ -105,11 +105,16 @@ def create_global_stats(services):
|
||||
'delivered': 0,
|
||||
'failed': 0,
|
||||
'requested': 0
|
||||
},
|
||||
'letter': {
|
||||
'delivered': 0,
|
||||
'failed': 0,
|
||||
'requested': 0
|
||||
}
|
||||
}
|
||||
|
||||
for service in services:
|
||||
for msg_type, status in itertools.product(('sms', 'email'), ('delivered', 'failed', 'requested')):
|
||||
for msg_type, status in itertools.product(('sms', 'email', 'letter'), ('delivered', 'failed', 'requested')):
|
||||
stats[msg_type][status] += service['statistics'][msg_type][status]
|
||||
|
||||
for stat in stats.values():
|
||||
|
||||
Reference in New Issue
Block a user