mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Sort platform admin page by requested messages.
- puts services that are doing things at the top.
This commit is contained in:
@@ -35,12 +35,19 @@ def platform_admin():
|
||||
form=form,
|
||||
**get_statistics(sorted(
|
||||
services,
|
||||
key=lambda service: (service['active'], service['created_at']),
|
||||
key=lambda service: (service['active'], sum_service_usage(service), service['created_at']),
|
||||
reverse=True
|
||||
))
|
||||
)
|
||||
|
||||
|
||||
def sum_service_usage(service):
|
||||
total = 0
|
||||
for notification_type in service['statistics'].keys():
|
||||
total += service['statistics'][notification_type]['requested']
|
||||
return total
|
||||
|
||||
|
||||
def get_statistics(services):
|
||||
return {
|
||||
'global_stats': create_global_stats(services),
|
||||
|
||||
Reference in New Issue
Block a user