mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
make sure we combine stats that are already there
eg we have yesterdays data and want to top it up with todays deltas 'use a defaultdict to make this painless'
This commit is contained in:
@@ -92,7 +92,7 @@ def create_empty_monthly_notification_status_stats_dict(year):
|
||||
# nested dicts - data[month][template type][status] = count
|
||||
return {
|
||||
convert_utc_to_bst(start).strftime('%Y-%m'): {
|
||||
template_type: {}
|
||||
template_type: defaultdict(int)
|
||||
for template_type in TEMPLATE_TYPES
|
||||
}
|
||||
for start in utc_month_starts
|
||||
@@ -103,6 +103,6 @@ def add_monthly_notification_status_stats(data, stats):
|
||||
for row in stats:
|
||||
month = row.month.strftime('%Y-%m')
|
||||
|
||||
data[month][row.notification_type][row.notification_status] = row.count
|
||||
data[month][row.notification_type][row.notification_status] += row.count
|
||||
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user