mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-06 07:58:24 -04:00
Add support for new template statistics API response
The new API response for template statistics returns separate count for each status. We get rid of template stats for cancelled notifications and group the rest of the statuses together.
This commit is contained in:
@@ -268,8 +268,9 @@ def get_inbox_partials(service_id):
|
||||
|
||||
def aggregate_template_usage(template_statistics, sort_key='count'):
|
||||
templates = []
|
||||
template_statistics = [s for s in template_statistics if s.get("status") != "cancelled"]
|
||||
for k, v in groupby(sorted(template_statistics, key=lambda x: x['template_id']), key=lambda x: x['template_id']):
|
||||
template_stats = [s for s in v if s.get('status') != 'cancelled']
|
||||
template_stats = list(v)
|
||||
|
||||
templates.append({
|
||||
"template_id": k,
|
||||
|
||||
Reference in New Issue
Block a user