mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-28 09:59:59 -04:00
Sort services by newest created first
Other than which services are live it’s also interesting to know what services are getting created on Notify. So let’s put the newest ones at the top of the page.
This commit is contained in:
@@ -18,7 +18,11 @@ def platform_admin():
|
||||
services = service_api_client.get_services({'detailed': True})['data']
|
||||
return render_template(
|
||||
'views/platform-admin.html',
|
||||
**get_statistics(services)
|
||||
**get_statistics(sorted(
|
||||
services,
|
||||
key=lambda service: service['created_at'],
|
||||
reverse=True
|
||||
))
|
||||
)
|
||||
|
||||
|
||||
@@ -67,5 +71,6 @@ def format_stats_by_service(services):
|
||||
'delivered': sum(stat['delivered'] for stat in stats),
|
||||
'failed': sum(stat['failed'] for stat in stats),
|
||||
'restricted': service['restricted'],
|
||||
'research_mode': service['research_mode']
|
||||
'research_mode': service['research_mode'],
|
||||
'created_at': service['created_at']
|
||||
}
|
||||
|
||||
@@ -65,7 +65,8 @@ def service_json(
|
||||
'sms_sender': sms_sender,
|
||||
'research_mode': research_mode,
|
||||
'organisation': organisation,
|
||||
'branding': branding
|
||||
'branding': branding,
|
||||
'created_at': str(datetime.utcnow())
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -84,7 +84,8 @@ def mock_get_detailed_service(mocker, api_user_active):
|
||||
'statistics': {
|
||||
'email': {'requested': 0, 'delivered': 0, 'failed': 0},
|
||||
'sms': {'requested': 0, 'delivered': 0, 'failed': 0}
|
||||
}
|
||||
},
|
||||
'created_at': str(datetime.utcnow())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user