Skip to content

Commit 15bf967

Browse files
smcmurtrywhabanks
andauthored
fix bug where sent in the last week email totals were always 0 (#2826)
Co-authored-by: William B <7444334+whabanks@users.noreply.github.com>
1 parent 70d64b3 commit 15bf967

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

app/dao/fact_notification_status_dao.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ def _stats_for_days_facts_with_billable_units(service_id, start_time, by_templat
398398
FactNotificationStatus.service_id == service_id,
399399
FactNotificationStatus.bst_date >= start_time,
400400
FactNotificationStatus.key_type != KEY_TYPE_TEST,
401-
FactNotificationStatus.notification_type == SMS_TYPE,
402401
)
403402
.group_by(
404403
FactNotificationStatus.notification_type,
@@ -417,13 +416,12 @@ def _stats_for_today_with_billable_units(service_id, start_time, by_template=Fal
417416
Notification.status,
418417
*([Notification.template_id] if by_template else []),
419418
*([func.count().label("count")]),
420-
*([func.sum(Notification.billable_units).label("billable_units")]),
419+
*([func.coalesce(func.sum(Notification.billable_units), 0).label("billable_units")]),
421420
)
422421
.filter(
423422
Notification.created_at >= start_time,
424423
Notification.service_id == service_id,
425424
Notification.key_type != KEY_TYPE_TEST,
426-
Notification.notification_type == SMS_TYPE,
427425
)
428426
.group_by(
429427
Notification.notification_type,

0 commit comments

Comments
 (0)