add broadcast to template_types and add broadcast_data

had to go through the code and change a few places where we filter on
template types. i specifically didn't worry about jobs or notifications.

Also, add braodcast_data - a json column that might contain arbitrary
broadcast data that we'll figure out as we go. We don't know what it'll
look like, but it should be returned by the API
This commit is contained in:
Leo Hemsted
2020-07-02 12:12:34 +01:00
parent 3954cd0e4a
commit 7ecd7341b0
12 changed files with 45 additions and 22 deletions

View File

@@ -3,7 +3,7 @@ from datetime import datetime
from notifications_utils.timezones import convert_utc_to_bst
from app.models import NOTIFICATION_STATUS_TYPES, TEMPLATE_TYPES
from app.models import NOTIFICATION_STATUS_TYPES, NOTIFICATION_TYPES
from app.dao.date_util import get_months_for_financial_year
@@ -37,7 +37,7 @@ def format_admin_stats(statistics):
def create_stats_dict():
stats_dict = {}
for template in TEMPLATE_TYPES:
for template in NOTIFICATION_TYPES:
stats_dict[template] = {}
for status in ('total', 'test-key'):
@@ -79,7 +79,7 @@ def create_zeroed_stats_dicts():
return {
template_type: {
status: 0 for status in ('requested', 'delivered', 'failed')
} for template_type in TEMPLATE_TYPES
} for template_type in NOTIFICATION_TYPES
}
@@ -100,7 +100,7 @@ def create_empty_monthly_notification_status_stats_dict(year):
return {
convert_utc_to_bst(start).strftime('%Y-%m'): {
template_type: defaultdict(int)
for template_type in TEMPLATE_TYPES
for template_type in NOTIFICATION_TYPES
}
for start in utc_month_starts
}