Added key_type to resultset

This commit is contained in:
Rebecca Law
2018-12-04 12:02:43 +00:00
parent c766febe94
commit 20fbb96bc2

View File

@@ -144,7 +144,7 @@ def fetch_notification_status_totals_for_all_services(start_date, end_date):
stats = db.session.query( stats = db.session.query(
FactNotificationStatus.notification_type.label('notification_type'), FactNotificationStatus.notification_type.label('notification_type'),
FactNotificationStatus.notification_status.label('status'), FactNotificationStatus.notification_status.label('status'),
FactNotificationStatus.key_type, FactNotificationStatus.key_type.label('key_type'),
func.sum(FactNotificationStatus.notification_count).label('count') func.sum(FactNotificationStatus.notification_count).label('count')
).filter( ).filter(
FactNotificationStatus.bst_date >= start_date, FactNotificationStatus.bst_date >= start_date,
@@ -174,10 +174,12 @@ def fetch_notification_status_totals_for_all_services(start_date, end_date):
query = db.session.query( query = db.session.query(
all_stats_table.c.notification_type, all_stats_table.c.notification_type,
all_stats_table.c.status, all_stats_table.c.status,
all_stats_table.c.key_type,
func.cast(func.sum(all_stats_table.c.count), Integer).label('count'), func.cast(func.sum(all_stats_table.c.count), Integer).label('count'),
).group_by( ).group_by(
all_stats_table.c.notification_type, all_stats_table.c.notification_type,
all_stats_table.c.status, all_stats_table.c.status,
all_stats_table.c.key_type,
).order_by( ).order_by(
all_stats_table.c.notification_type all_stats_table.c.notification_type
) )