mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
Fixes to the template usage page
- When a year contains no data ensure a default set of months is returned so that all months can be seen in the UI - Add the template id so the user can click through to the template
This commit is contained in:
@@ -117,9 +117,18 @@ def template_usage(service_id):
|
|||||||
|
|
||||||
stats = sorted(stats, key=lambda x: (x['count']), reverse=True)
|
stats = sorted(stats, key=lambda x: (x['count']), reverse=True)
|
||||||
|
|
||||||
|
months = [
|
||||||
|
{
|
||||||
|
'name': yyyy_mm_to_datetime(month).strftime('%B'),
|
||||||
|
'templates_used': {},
|
||||||
|
}
|
||||||
|
for month in get_months_for_financial_year(year, time_format='%Y-%m')
|
||||||
|
]
|
||||||
|
|
||||||
templates_by_month = defaultdict(list)
|
templates_by_month = defaultdict(list)
|
||||||
for stat in stats:
|
for stat in stats:
|
||||||
templates_by_month[int(stat['month'])].append({
|
templates_by_month[int(stat['month'])].append({
|
||||||
|
'id': stat['template_id'],
|
||||||
'name': stat['name'],
|
'name': stat['name'],
|
||||||
'type': stat['type'],
|
'type': stat['type'],
|
||||||
'requested_count': stat['count']
|
'requested_count': stat['count']
|
||||||
|
|||||||
Reference in New Issue
Block a user