mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-11 18:37:33 -04:00
Put some stuff on the page
This basically copies the same sections from the existing performance platform page, with the frontend cobbled together from our existing patterns.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from datetime import datetime, timedelta
|
||||
from itertools import groupby
|
||||
from operator import itemgetter
|
||||
from statistics import mean
|
||||
|
||||
from flask import render_template
|
||||
|
||||
@@ -12,6 +15,23 @@ def performance():
|
||||
start_date=(datetime.utcnow() - timedelta(days=90)).date(),
|
||||
end_date=datetime.utcnow().date(),
|
||||
)
|
||||
stats['organisations_using_notify'] = sorted(
|
||||
[
|
||||
{
|
||||
'organisation_name': organisation_name,
|
||||
'count_of_live_services': len(list(group)),
|
||||
}
|
||||
for organisation_name, group in groupby(
|
||||
stats['services_using_notify'],
|
||||
itemgetter('organisation_name'),
|
||||
)
|
||||
],
|
||||
key=itemgetter('organisation_name'),
|
||||
)
|
||||
stats['average_percentage_under_10_seconds'] = mean([
|
||||
row['percentage_under_10_seconds']
|
||||
for row in stats['processing_time']
|
||||
] or [0])
|
||||
return render_template(
|
||||
'views/performance.html',
|
||||
**stats
|
||||
|
||||
Reference in New Issue
Block a user