group results by service using itertools

allows us to nicely reuse the existing format_statistics function
This commit is contained in:
Leo Hemsted
2016-08-19 16:36:20 +01:00
parent ebb13a1251
commit 00d19f63f0
3 changed files with 14 additions and 10 deletions

View File

@@ -187,6 +187,7 @@ def dao_fetch_todays_stats_for_all_services():
return db.session.query(
Notification.notification_type,
Notification.status,
Notification.service_id,
func.count(Notification.id).label('count')
).select_from(
Service
@@ -199,4 +200,6 @@ def dao_fetch_todays_stats_for_all_services():
Notification.notification_type,
Notification.status,
Notification.service_id
).order_by(
Notification.service_id
)