mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-09 17:45:41 -04:00
Adding group by clause to outer query for function.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -484,12 +484,19 @@ def dao_fetch_stats_for_service_from_days(service_id, start_date, end_date):
|
|||||||
.subquery()
|
.subquery()
|
||||||
)
|
)
|
||||||
|
|
||||||
stmt = select(
|
stmt = (
|
||||||
func.sum(sub_stmt.notification_count).label("total_notifications"),
|
select(
|
||||||
sub_stmt.notification_type,
|
func.sum(sub_stmt.notification_count).label("total_notifications"),
|
||||||
sub_stmt.status,
|
sub_stmt.notification_type,
|
||||||
sub_stmt.day,
|
sub_stmt.status,
|
||||||
func.sum(sub_stmt.count).label("count"),
|
sub_stmt.day,
|
||||||
|
func.sum(sub_stmt.count).label("count"),
|
||||||
|
)
|
||||||
|
.group_by(
|
||||||
|
sub_stmt.notification_type,
|
||||||
|
sub_stmt.status,
|
||||||
|
sub_stmt.day,
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return db.session.execute(stmt).all()
|
return db.session.execute(stmt).all()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user