From 20fbb96bc24d7f43afe793b3b26d60505a1a1271 Mon Sep 17 00:00:00 2001 From: Rebecca Law Date: Tue, 4 Dec 2018 12:02:43 +0000 Subject: [PATCH] Added key_type to resultset --- app/dao/fact_notification_status_dao.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/dao/fact_notification_status_dao.py b/app/dao/fact_notification_status_dao.py index 486aa1213..1390201e8 100644 --- a/app/dao/fact_notification_status_dao.py +++ b/app/dao/fact_notification_status_dao.py @@ -144,7 +144,7 @@ def fetch_notification_status_totals_for_all_services(start_date, end_date): stats = db.session.query( FactNotificationStatus.notification_type.label('notification_type'), FactNotificationStatus.notification_status.label('status'), - FactNotificationStatus.key_type, + FactNotificationStatus.key_type.label('key_type'), func.sum(FactNotificationStatus.notification_count).label('count') ).filter( 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( all_stats_table.c.notification_type, all_stats_table.c.status, + all_stats_table.c.key_type, func.cast(func.sum(all_stats_table.c.count), Integer).label('count'), ).group_by( all_stats_table.c.notification_type, all_stats_table.c.status, + all_stats_table.c.key_type, ).order_by( all_stats_table.c.notification_type )