From 219d5943c1be33dfdb667330a640cf7db9c99f52 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 4 Oct 2016 13:04:42 +0100 Subject: [PATCH] Return iterator from query for speed --- app/dao/notifications_dao.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dao/notifications_dao.py b/app/dao/notifications_dao.py index 870239837..40c1e8cb2 100644 --- a/app/dao/notifications_dao.py +++ b/app/dao/notifications_dao.py @@ -225,7 +225,7 @@ def get_notification_billable_unit_count_per_month(service_id, year): NotificationHistory.service_id == service_id, NotificationHistory.created_at >= start, NotificationHistory.created_at < end - ).all() + ) return [ (month, sum(count for _, count in row))